Multilingual Ghost CMS Blog: 2. Making 'More Posts' Multilingual
When you look at a post, you can see that even if it is an English post, the show_recent_posts section at the bottom displays all posts regardless of language. Let's fix this part. 0.0.2 · sanghunka/ghost-multilingual-theme@0e2b7a3: Multilingual show_recent_posts_footer Edit post.hbs {{# get "posts" filter = "id:-{{id}}" limit = "3" as | more_posts | }} {{#if more_posts }} <aside class=…
In a recent update to the Multilingual Ghost CMS Blog, the author made a significant modification to the way recent posts are displayed. Previously, regardless of the post's language, the show_recent_posts section at the bottom of each post would display the three most recent posts, regardless of language. This sometimes resulted in posts appearing in a language that did not match the post's original language tag.
To address this issue, the author introduced a new code snippet that dynamically filters the posts based on their language tag. The modification involves adding conditional statements that check for the #en or #ko tags, depending on the post's language.
When a post is tagged with #en, the code applies the filter tag:en, ensuring that only English posts are displayed in the recent posts section. Similarly, when a post is tagged with #ko, the code applies the filter tag:ko, displaying only Korean posts in the section.
By implementing this change, the author successfully ensures that only posts matching the language tag of the current post are shown at the bottom. This means that when a user encounters a post in a specific language, the recent posts section will only display additional posts written in that same language, providing a more cohesive and relevant reading experience for the user.
This improvement enhances the user interface of the Multilingual Ghost CMS Blog, making it more intuitive for readers to navigate through posts of similar language. The author's attention to detail in addressing this specific issue demonstrates their commitment to providing a seamless and user-friendly experience for the Ghost CMS Blog community.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.