I have a page template which uses this section of code below, but I need to make a slight modification:
{{#get "pages" include="tags,authors,tiers" filter="tags:[{{post.tags}}]" limit="all"}}
{{#foreach pages}}
{{> resource-card}}
{{/foreach}}
{{/get}}
The current behavior is to fetch all pages sharing any tag with this page, then render post cards for each of those pages.
I want to make it so that post cards are rendered only for pages whose secondary tag matches the primary tag of this page.
I know that there’s a few ways to reference specific tags, like
{{primary_tag}}
for the primary tag and
{{tags.[1]}}
for the secondary tag.
But I’m having trouble putting this information together into a logical statement. I’m also not sure whether the logic should be applied in the #get filter or in the #foreach loop…
Could anyone give me a hint to push me in the right direction?