Related posts yield the same 2 posts 95% of the time

I’m using Ghost 3.4 (and getting same effect on G4) and have a theme with a “related posts” component. I have about 85 posts I transferred over from Substack. Most posts have about 4-5 tags.

My related posts component is closely based on the Ghost tutorial on the topic, as follows:

{{#get 'posts' limit='2' include='tags' filter='tags:[{{post.tags}}]+id:-{{post.id}}' as |related-posts|}}
  {{#if related-posts}}
    <div class='c-related'>
      <div class='c-title-bar'>
        <h3 class='c-title-bar__title'>{{t 'You might also like' }}</h3>
      </div>
    {{> loop }}
    </div>
  {{/if}}
{{/get}}

Unfortunately, this results in pretty much the same 2 articles being shown after every post. My understanding is that Ghost is supposed to look for an overlap of tags. (ie if an article matches 3 tags, then it has priority over an article with 2 matches)

Would you have any tips for creating more diverse matches? Or is there a bug? How would I get to make match based on primary tag?

Thanks

This post has some background and Hannah is saying there should be a match based on number of tags overlapping:

I was able to solve my own problem, thanks to this great article by @brightthemes about various ways of displaying related posts using different variables (such as including featured posts, certain tags, etc.):

How to Show Related Posts in Ghost | Biron Themes

It only took me 17 hours of research…thanks for nothing, Forum

1 Like