Hello,
I am on Ghost Pro Starter with “Source” theme.
i have an issue with the “read more” section on my blog.
I’ve noticed that the section only shows the 4 lastest post and not the posts with the same tags or keywords.
So I find it useless because the posts are not in relation with the article that is being read.
Is it possible to solve this with code injection or something else?
Thanks
Hi @Nathanael … I’m anything but a Ghost expert but am trying to sort out the same issue. Have a look at this link. You need to use a filter to retrieve the posts, something like this:
{{#get
'posts'
include='tags,authors'
limit='3'
filter='id:-{{id}}+tag:[{{primary_tag.slug}}]'
}}
<!-- Display related post details here -->
{{/get}}
On the filter line the id:-{{post.id}}
excludes the current post and the rest of it defines what is being selected.
You need to make these changes in the relevant theme file (and then upload the modified theme) which might be related.hbs
or related_posts.hbs
depending upon the theme you are using.
1 Like
@Nathanael , I think you said you are on the Ghost Starter plan, right? That’s not going to allow you to edit the theme, which is what @fatshark is suggesting (and how I’d generally do it). If you’re handy with JavaScript, you could instead retrieve the posts from the Content API and add them to the page. I’ve got a JavaScript example sketched out here:
But be warned that it doesn’t include the code for actually creating the post cards and adding them to the page.
1 Like
Hello @Cathy_Sarisky, and thanks for the idea, but I don’t understand how to implement it…
I tried to copy-paste the code you give in the 2nd chapter of your post in header or footer, but it doesn’t change anything
And I even don’t know what an API is