I am using Ghost + Gatsby on my website. I need to add i18n to the site. How can I add some of the blog posts in French and query them accordingly with graphql? Can someone please help with this? I have read articles regarding i18n only for Gatsby but not as a combination(Ghost + Gatsby).
Hi, You can start with this tutorial.
This tutorial is for Ghost theme but I think using a dedicated tag and correct collection configuration you can query only the French posts ( let’s assume all your French post has the tag fr).
I can not write graphql query but if you check the Content API you can get the idea.
Not sure about it but I think as you are using Gatsby, and Ghost as headless CMS, you probably do not need the collection configuration, filtering posts by tag should be enough.
Thank you. So we will have to create a new post and add the internal tag #fr to that post and then filter the post by the internal tag?
Yes that’s right. Internal or external tag will fulfill same purpose I will suggest to use internal tag.
To get French posts, filter posts which has the internal tag #fr and all other posts which dose not have #fr tag will be your normal ( default language ) posts.
BTW, I will like to see the end result. If possible then share it here once you complete the development. Good luck.