How do I show a list of notes in my Obsidian vault that do not include a tag name?

452 views Asked by At

In my MOC pages, I would like to display a list of notes with tag1 & tag2, but not notes that contain tag3.

I use YAML frontmatter in my notes in Obsidian and include a property for tags i.e. tags: [tag1, tag2, tag3]. I also have MOC pages which are just a menu of links to related notes where I write inline DataviewJS queries to display the links.

I am currently able to display notes with multiple tags such as tag1 and tag2 with the following inline query, but now I want to exclude notes with a specific tag such as tag3.

`$=dv.list(dv.pages('"Notes"').where(p => p.file.tags.includes("#tag1") && p.file.tags.includes("#tag2")).file.link)`

How would I go about modifying the above query to include notes with tag1 and tag2, but not include notes with tag3?

I guess what I really need to find out is what properties are available under p.file.tags. Does anyone know a good way to examine what properties that are available?

Is there something like p.file.tags.notincludes("#tag3") or something?

1

There are 1 answers

0
John Smith On

ChatGPT gave me the answer I needed. Tested it out and it works great.

`$=dv.list(dv.pages('"Notes"').where(p => p.file.tags.includes("#tag1") && p.file.tags.includes("#tag2") && !p.file.tags.includes("#tag3")).file.link)`