Get tags on multi-language theme with filter


I am using the latest version of Ghost. I am a Ghost theme developer. Recently I have faced an issue when customizing themes for my clients with Multi-language content support. I have followed all instructions found here: { }. Everything { posts with internal tags #en #ru #es } is working well except one problem. They want to show a tag cloud section { example: show English tags only used for English posts and Russian tags for Russian posts } on the home page and posts page. To complete this task, I have found one solution. In order to filter language specific tags, I have to hardcoded associated tags in theme files for all languages { #get “tags” with filter=“slug:-[tag-name-one, tag-name-two]” then #foreach tags }, but it is not a good idea. Because they will add some tags later on their blog.

Here is my routes.yaml file for an EN+RU blog


permalink: /{slug}/
template: index
filter: ‘tag:-hash-ru’
permalink: /ru/{slug}/
template: index-ru
filter: ‘tag:hash-ru’

tag: /tag/{slug}/
author: /author/{slug}/

Am I missing something? Is there any way to get and foreach tags with filter for multi-language theme as like filtering posts based on internal tags with routes.yaml? If not then is not it a good idea to add a label field for every tags on Ghost?

Thank You!

Hey @anisul :wave:
If you wanted to show a tag cloud on the index page for each of your languages you could assign page data to a collection page. There’s an example here in our docs. Once you’ve added the page you can then add tags to that page which are relevant to that language. So for the “en” page you assigned to the “en” collection data you’ll apply all the “en” related tags.

Using this method give you the control without having to get into the code each time to update content.

Hope this makes sense! Let us know if you need more guidance :blush: