Multlingual: have content slugs at top level (not under language code)l?

We have a multilingual sites, but we want want to have all the multilingual content to be published to the top level, rather under the language path, but I can’t see how to do it?

If I use defaultContentLanguageInSubdir, then the ‘main’ language is at the base, but other languages are under a language code path. If I remove it all languages appear under language code path. Neither represent what we want to do.

Given content:

content
  - mypage.fr.md , with `slug: /frenchslug`
  - mypage.en.md , with `slug /englishslug`

We would like it so the result is:

http://www.example.none/frenchslug
http://www.example.none/englishslug

Can anyone suggest how we could achieve this?

As written, this is not true.

With this:

defaultContentLanguage = 'en'
defaultContentLanguageInSubdir = false

You get this:

https://example.org/post/post-1.md
https://example.org/fr/post/post-1.md

And with this:

defaultContentLanguage = 'en'
defaultContentLanguageInSubdir = true

You get this:

https://example.org/en/post/post-1.md
https://example.org/fr/post/post-1.md

What you want:

https://example.org/frenchslug/post/post-1.md
https://example.org/englishslug/post/post-1.md

is not currently possible. If your slugs were 8 characters or less, you could bend the system to meet your needs using artificial language tags, but you would loose the ability to localize dates, currencies, numbers, and percentages.

Currently, the key in [languages.xx] is used to:

  1. Lookup translations in the i18n directory
  2. Localize dates, currencies, numbers, percentages
  3. Set the first level of the URL path

It would be nice if #3 could be controlled on a per-language basis, but I suspect that would be an expensive change.

2 Likes