From 5e23bb65e6b9d1e2cc1ac642cb5f9d9d08389bee Mon Sep 17 00:00:00 2001 From: Badri Sunderarajan Date: Wed, 15 Mar 2023 14:37:58 +0530 Subject: [PATCH] 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. --- post.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post.hbs b/post.hbs index fa9e679..b250f26 100644 --- a/post.hbs +++ b/post.hbs @@ -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 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}} {{#foreach more_posts}} {{> "post-card"}}