SaaS CMS has officially launched! Learn more now.

Language routing


I have a multilingual CMS12 site which has a URL structure that contains the country and language in the path, and this is mapped to one global domain like so: → GB country with spanish content → GB country with french content  → Spain country with Spanish content

However, if a country is translated to just one language, we want to ditch the language code in the URL.

In the example above, the spain website is only translated with the spanish language, so we want the URL structure to be like so:

Essentially ditching the /es language segment because we know only spanish is available here.

Anyone ever come across something similar for this or have any suggestions for how we could implement it?

Jun 13, 2024 15:24

Hi James.

It sounds like you've got a fairly interesting language setup to start with given the non-standard languages (e.g. es-GB) and the extra segment used to identify the locale (e.g. /gb/es rather than /gb-es). Are the languages set up as separate language branches in the CMS or do those languages exist as separate nodes within the site tree?

Jun 14, 2024 16:15

Hey Paul

Indeed this is an interesting one. We know it's slightly against best practice but it stems from some old SEO practices that we must temporarily inherit into a new website build to keep our SEO ranking intact for now.

For some reason the forums aren't allowing me to attach images at this moment in time, so to explain the CMS tree, we've got the root page followed by a "Country Home Page" representing each of the countries (or "markets)"

CMS Root
  - BE
    - About
    - Services
    - ... etc
   - GB
    - About
    - Services
    - ...etc
  - NL
  - FR
  - ES

So by default, we'd access these country pages like so:

... etc

But then these country pages can have multilingual variants. And as soon as this is switched on, as you know, the language segment comes into play in the URL, by default:

..and as you suggest, this isn't good practice. It really should be

So this is where it's getting a bit confusing - I'm trying to get some programmatic exposure over the language segment in the URL, so that I can apply some rules to it.

Firstly, to change the location of language segment so instead of - we can bring it more inline with best practice SEO which would be 

And secondly to ditch the language segment completely when only one language is available.

Edited, Jun 27, 2024 11:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.