Tempalte filter pages by tag and show it's other tags

Hello I am new to SilverBullet and still learning all of its features. Ive seen that you can display all tags as a clickable link and even show the tags of a page your are currently on as clickable links

I was wondering if someone could guide me on how to do something similar. I would like to create a template that shows all the pages that have the tag, “TAG1”, and the rest of its tags as clickable links. The example output would be something like:

CLICKABLEPAGENAME: #TAG2 #TAG3 #TAG4

I am aware you can get pages that have a certain tag with template by:

{{#each {TAG1}}}
[[{{name}}]]:
{{/each}}

however I am unsure how to go about showing/filtering a pages tags

Any help would be appreciated.

Following template should do the trick.

We loop over all the pages with the given tag (#each {tag} might include other things than pages), then for each page we loop over its tags and print them excluding the tag that we are listing.

{{#let @tag = "TAG1"}}
{{#each {page where tags = @tag}}}
[[{{name}}]]:{{#each @t in tags}}{{#if @t != @tag}} #{{@t}}{{/if}}{{/each}}

{{/each}}{{/let}}
1 Like

I see, that makes sense. The explanation and solution is greatly appreciated.