How do I access current file frontmatter tags in a base?

What I’m trying to do

I have a standalone “Topic Base” file that will be embedded on all of my topic files.

I’d like to be able to associate topics with tags so that I can build a base on my topic page that can bring back all tags that are associated to that topic. I want to be able to do this without having to create a bespoke base query for each topic. I’d like to have a single Base file which can be embedded on every topic page.

The idea I had for doing this was to refer to own file tags. So query in plain English would essentially be: bring back all pages which are tagged with any tag in this.file.tags, excluding self.

To give an example - I have a “frontend developer” file. I would add the “frontend-developer” tag to the tags field in this file. The base query would pull back all files which contain the “frontend-developer” tag, excluding self.

Things I have tried

I have tried this filter tags.containsAny(this.file.tags) along with similar variants but it’s not working. Is what I’m trying to do supported by bases?

Hello.

Does this work?


```base
views:
  - type: table
    name: Table
    filters:
      and:
        - file.tags.containsAny(this.file.tags)

```

Perfect, thank you! Seems like I was just missing the file. part at the start!

1 Like