-
-
Notifications
You must be signed in to change notification settings - Fork 875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Related Posts plugin #26
Comments
Any update on this ?, How we can show related posts on frontend just like ghost's casper theme ? |
See my casper-v3 fork for a solution. The trick is to use grapghql queries in post.js like so:
which can be accessed with |
@styxlab your link to your Casper fork is broken. I am really blocked as I would like to list all posts having the same tags as current post. Where you be able to solve that? Thanks |
for anyone looking for a hacky solution to this, i've been able to get related posts showing I'm not a GraphQL expert and this isn't a plugin but you can find the code used here. I'm basically using the It's not the greatest but I hope it helps someone who was stuck like me. |
Problem description
It is possible to fetch related posts based on how many tags they have in common. A current implementation of that can be found in the Ghost Docs repository here. This code is very specific to the Ghost Docs requirements and also very messy.
There are probably better solutions to solve this, but this one works and can be a good starting point to create a plugin for the
Proposal
I had a play with this already, trying to add related posts to the GraphQL schema, but wasn't successful. This might be due to my lack of GraphQL knowledge, or simply because it's not possible that way.
The working solution in Ghost Docs inserts the related posts into the
PageContext
which is another option (not such a nice one, as having it available with a pretty GraphQL query) to implement this.Maybe (probably) there are even better ways on doing that? This needs further research.
Todos
The text was updated successfully, but these errors were encountered: