Use metadatafields from 'current note' in dataview query

Things I have tried

I have searched quite a bit. I just can’t seem to find a function that takes the current file’s metadata as an input. I’ve tried a lot of variations of

<% %>
<% %>
<% %>

What I’m trying to do

I’m trying to create a table where I use the current file’s metadata fields as an input. So let’s say I have a field in my metadata that looks like this:

date: 2022-11-06
food-type: Italian

I want to create a dataview query that uses this file’s metadata field ‘food-type’ to bring back a query result from all other notes.

WHERE  contains(food-type,


List of pages with Italian as food-type 
- Lasagne
- Pizza
- Pasta alfredo
  • basic source to learn dataview: plugin documentation
  • basic thing to learn about metadata in dataview: the syntax and the structure of metadata in files
    • difference between implicit fields and custom custom fields
      • implicit fields: automatic metadata added to each file at page level or sub-levels (as tasks and lists); page level metadata use the prefix file
      • custom fields: created fields (in frontmatter or inline), distincts from page/file level - they don’t need the prefix file
  • if only one value in field, we can use “=” instead of contains()
WHERE contains(food-type,


WHERE food-type =

Thanks! Did not know you can just use “this.metadatafield”. Going to make my life much easier! +1 to you good sir :smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.