Template to list pages with a specific tag?

Hi,

I’m new to SB and I’m trying to create a page with a list of all pages grouped by tag.

So far I’ve created this:

{{#each {tag select name where parent != "builtin" order by name}}}
{{#let @tag_name = name}}

* [[📌 {{name}}]]
![[📌 {{name}}]]

{{/let}}
{{/each}}

I’m including the built-in tag page 📌 {{name}}, however I’d like to customize it as it’s a bit ugly for my intentions. I’m thinking that I’d need to create a new template to list links for all pages with a certain tag, but I have no idea how.

Any help is appreciated :slightly_smiling_face:

Ok, I’ve got it, this is working:

{{#each {tag select name where parent != "builtin" order by name}}}
{{#let @tag_name = name}}

## [[📌 {{name}}]]
{{{page where tags = @tag_name render [[Library/Core/Query/Page]]}}}
{{/let}}
{{/each}}

However the rendered content is showing this error in the first line:

Error: Parse error in: 

Not sure what causing it. Any idea how to debug that?

I’m not sure, but I’ve done it with tasks. I think every query result needs to have a tag. In your case each page. Maybe check if every page has a tag in its frontmatter section or anywhere else I guess. The Parse error in will usually tell you which pages are the problem.

Thanks for your comment. The issue was that I was using a query block instead of a template block.

1 Like