Multi-language content out of the homepage

Hi there.

I have my multi-language blog working fine. So if I go to my blog homepage is shows all the English articles and if I go to the /es it shows all the Spanish articles.

What I’m struggling with now is to get the list of articles in the right language for other sections, for example in the tag one.

So if I go to /tag/mytag it should show all the English articles while if I go to /es/tag/mytag it should show only the articles in Spanish.

Is this possible? because I have been trying setting the route in the routes.yml but I haven’t been able.

Thank you.

I’ve encountered this scenario before and the best solution was to make sure that the tag slugs were translated correctly. More often than not tags won’t clash because they will be translated for their relevant language.

However if you are still concerned about this you could prefix your tag slugs with either en- or es- to prevent them overlapping :+1:

Hi @DavidDarnes, thank you for your answer.

If I understood well, the solution is then to have different tags for different languages, is that correct? there is no real solution for showing articles of just one language for the same tag.

Thanks.

It’s possible with custom channels in Ghost as well, but just so you’re aware it’ll require updating the routes file each time you add a new tag. Here’s an example:

routes:
  /es/tag/mytag/:
    controller: channel
    filter: tag:mytag+tag:-hash-en
  /en/tag/mytag/:
    controller: channel
    filter: tag:mytag+tag:-hash-es

For more info on Channels check out our docs:
https://ghost.org/docs/api/v3/handlebars-themes/routing/channels/

1 Like

Thanks. I think that’ll work.

I’m not planing in re-using all the tags in both languages, but there are certain tags that doesn’t make a lot of sense to translate, in that case I’ll use this solution.

Thank you!