Limit related posts to primary tag

If we matched by all tags, the "latest posts" were getting hogged
by a small set of posts that had many tags. Now, since we're more
restrictive, we end up throwing up new posts every time! Also, we
are allowing posts with the primary tag matching *any* of the
current post's tags; it doesn't just have to match the current
posts's primary tag.
This commit is contained in:
Badri Sunderarajan 2023-03-15 14:37:58 +05:30
parent 735508cdec
commit 5e23bb65e6

View file

@ -116,7 +116,7 @@ into the {body} tag of the default.hbs template --}}
This query gets the latest 3 posts on the site, but adds a filter to This query gets the latest 3 posts on the site, but adds a filter to
exclude the post we're currently on from being included. --}} exclude the post we're currently on from being included. --}}
{{#get "posts" filter="tags:[{{post.tags}}]+id:-{{post.id}}" include="authors" limit="3" as |more_posts|}} {{#get "posts" filter="primary_tag:[{{post.tags}}]+id:-{{post.id}}" include="authors" limit="3" as |more_posts|}}
{{#if more_posts}} {{#if more_posts}}
{{#foreach more_posts}} {{#foreach more_posts}}
{{> "post-card"}} {{> "post-card"}}