Force language prefix "de" while using language "de-at"

I use the theme “Blowfish”. My Hugo website is bilingual, the primary language is German.

Instead of German, I want to use the language code “de-at” (which is Austrian German). But the language prefix should still be “de” instead of “de-at”.

What I did:

  • In config.toml I set:

defaultContentLanguage = “de-at”
defaultContentLanguageInSubdir = true

  • I renamed languages.de.toml and menues.de.toml to languages.de-at.toml and menues.de-at.toml.
  • I copied the file /themes/blowfish/i18n/de.yaml, pasted it to /i18n/, and renamed it to de-at.yaml.

What I tried to achieve:

Hugo should use the language code “de-at” (it’s slightly different from “de”).

The main URL of my website should still use the language prefix “de”.

Current status:

Hugo uses the language code “de-at”.

The URL, however, is example.com/de-at.

I was able to force the language prefix for sections. For example, in /content/de/blog/_index.md I included url: "/de/blog/", so now the section URL is example.com/de/blog. Still, I can’t change the prefix for the front page or for individual permalinks.

What can I do?

What you want to do is currently not possible, at least not in a comprehensible way. You cannot decouple the language key from the language prefix, nor can you control localization separately from either of those.

Thanks for letting me know, @jmooring.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.