Dataview query for tags based on alias of host page

I just learned about Tag Wrangler’s “Tag Pages” feature and I’m looking at how I might take advantage of it (a way to possibly take advantage of the benefits of both links and tags). The jist of it is that you create a new page (the “Tag Page”) with an alias of “” (eg. “#Pets/Dogs”), and then ALT+ clicking on the tag in the sidebar opens the page for viewing. In the page, I’m thinking it would be nice to have a list of links to the page, and a list of pages that contain the tag. I know I can do a Dataview block with the following to get a list of links:

FROM [[]]

I know I can use a similar Dataview block to get a list of pages with a tag:

FROM #Pets/Dogs

What I’d like to do is have a template for creating these “Tag Pages”, where the query for tags gets the tag string from the alias of the page containing the block (so I don’t have to hard-code the tag for every Tag Page I create). For example:

  • The Tag Page for “Dogs” has an alias in the YAML Aliases: [ "#Pets/Dogs" ]
  • The page also has a code block to look for tags that begin with ‘#’
  • The code block finds #Pets/Dogs" in the YAML and assigns it to a variable which is then used in the code block:
FROM <tag variable>

Any ideas on how to do this? Bonus points if the solution can handle multiple tags in the alias!

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