jstein
1
How can I set the default language to German (DE) in the hugo-book theme?
I tried the following in the config.toml
but the language page still shows the English version first and the user has to switch to German manually.
defaultContentLanguage = 'de'
[languages]
[languages.de]
languageName = 'German'
contentDir = 'content.de'
weight = 1
[languages.en]
languageName = 'English'
contentDir = 'content.en'
weight = 2
idarek
2
Try
defaultContentLanguage = 'de'
[languages]
[languages.de]
languageName = 'German'
languageCode = "de-de"
contentDir = 'content/de'
weight = 1
[languages.en]
languageName = 'English'
languageCode = "en-gb"
contentDir = 'content/en'
weight = 2
shall work, as Book theme do not specify language by default.
jstein
3
I tried this, but unfortunately it still loads the English website first, because English is now placed to example.com and German is in example.com/de
I uploaded the complete source to GitHub - TroLUG/trolug-hugo: TroLUG homepage sources for hugo if someone from the future reads this, we are now at this commit:
try to fix default language · TroLUG/trolug-hugo@4d001e0 · GitHub
irkode
4
Mmh, your mentiond commit has no english content…
Nevertheless
-
line 23 defaultContentLanguage = 'de'
This is a toplevel entry and cannot be located after the first defined array
Move it above line 12. I would suggest to place it after line 4
-
your default language is in a subdir
What about setting defaultContentLanguageInSubdir to true
This is also a top level entry
2 Likes
system
Closed
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.