Within a custom post.hbs, I want to display related posts based on at least one shared tag. I assume that I’m just missing something simple in the syntax.
This is a trivial example (not what I want):
{{#get "posts" filter="primary_tag:{{primary_tag.slug}}" limit="all"}}
The documentation and most forum posts show this example (again, not what I’m after because it is not dynamic. Just providing context):
{{#get "posts" filter="tag:[explicit-tag-a, explicit-tag-b]" limit="all"}}
I want to retrieve all posts that share at least one common tag with the post in focus dynamically. For example:
/post-in-focus has tags: Explicit A, Explicit B
/related-post-1 has tags: Explicit B, Explicit C
/related-post-2 has tags: Explicit A, Explicit D
/unrelated-post-1 has tags: Explicit D, Explicit E
So related-post-1 passes the filter because it shares the Explicit B tag and related-post-2 would pass the filter because it shares the Explicit A tag. unrelated-post-1 would fail the filter because it has no posts in common with the post-in-focus.
I have tried the following without success, but maybe they illustrate the objective:
{{#get "posts" filter="tag:[{{tags}}]" limit="all"}}
{{#get "posts" filter="tag:[{{post.tags}}]" limit="all"}}
{{#get "posts" filter="tags:[{{tags}}]" limit="all"}}
{{#get "posts" filter="tags:[{{post.tags}}]" limit="all"}}
Thanks for any suggestions. Yes, I have already read the following more than once: