Issue with routing on multilingual

Hello ! I’m currently building a multilingual blog and i’m quite lost with routing.

I don’t only need posts in a certain language (which can be achieved using tag filter on routing) but also the global context of the website, including categories url on menu.

So, i made a template (hbs) for each categories where i filter directly on the post loop. Which is working well actually.

Now my problem is my routing. It’s looking like that :


permalink: /{slug}/
template: index
filter: ‘tag:fr’
permalink: /tips-tactics-strategies/
template: categories/strategies
permalink: /product/
template: categories/product
permalink: /news/
template: categories/news
permalink: /guides/
template: categories/guides

permalink: /en/{slug}/
template: multilingual/en/index
filter: ‘tag:en’
permalink: /en/tips-tactics-strategies/
template: multilingual/en/categories/strategies
permalink: /en/product/
template: multilingual/en/categories/product
permalink: /en/news/
template: multilingual/en/categories/news
permalink: /en/guides/
template: multilingual/en/categories/guides

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

It’s a bit overkill but i want all the website (menu, footer…) to be localized and it did’nt saw how to make conditions on lang variable…{{#has {{lang}}=“en”}}{{/has}} do not seems to be an option. Or maybe i’m doing it wrong :slight_smile:

The problem with this routing is that when im on /en/ , the post url are redirected to /tipcs-tactics-strategies/…because of routing priority i guess.

Any help on those subjects ? Thank you very much :slight_smile:

Hey @alexsnti,

It looks like from your collections definition you’re not fully filtering the posts into the collection pages properly. Some of the collection routes you defined don’t have any filters. You should take advantage of tags more to allow you to filter content better.

Also you might want to look into channels, where you can filter content on pages but allow posts to co-exist in other channels and collections:

Hope this helps! :blush:

Hey David ! Thank you for this hint, now everything is working ! I used channels as suggested and collections.

Thank you for the help !

1 Like

No problem! Glad I was able to help :blush: