Language routing

Vote:
 

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:

example.com/gb/es/about → GB country with spanish content

example.com/gb/fr/about → GB country with french content

example.com/es/es/about  → 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:

example.com/es/about

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?

#323512
Jun 13, 2024 15:24
Vote:
 

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?

#323563
Jun 14, 2024 16:15
Vote:
 

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:

example.com/be

example.com/be/about

example.com/be/services

example.com/nl/

... 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:

example.com/en/be/about

..and as you suggest, this isn't good practice. It really should be example.com/be/en/about

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 example.com/en/be - we can bring it more inline with best practice SEO which would be example.com/be/en 

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

#324416
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.