I’ve been fiddling with the multilingual feature, and just found an issue today.
Up until now I didn’t see it because I was using DefaultContentLanguage = "en" . Today I changed to DefaultContentLanguage = "de" and it turned out that the default language of the site is still English.
Here a simplified version of my config:
IsMultiLingual = true
DefaultContentLanguage = "de"
DefaultContentLanguageInSubdir = false
[Languages]
[Languages.de]
weight = 2
title = "Meine Website auf Deutsch"
languageName = "Deutsch"
[[Languages.de.menu.main]]
name = "Startseite"
weight = -110
identifier = "home"
url = "/"
[Languages.en]
weight = 1
title = "My site in English"
languageName = "English"
[[Languages.en.menu.main]]
name = "Home"
weight = -110
identifier = "home"
url = "/"
If I use this config, the English version is being served by default. Now, if I remove completely the English part, the German version comes up (which shows that the config should be OK).
I’ve also tried to change the weight parameter for both languages but it still doesn’t work for me.
Yes, and I suspect that is your issue. The default content language in subdir feature was added late in the development cycle, so you should pull the latest Hugo and build that.
So, I’ve pulled the latest source and built Hugo using make and this is what I get when I print {{ .Hugo.CommitHash }}: 2071d47
That should mean I have the latest and greatest installed right?
However, it still doesn’t work for me.
As an experiment, I have completely removed the English language from my site and replaced all occurences of “en” to “fr” (in the menus, config, i18n files etc) I’ve also changed all extensions of the content files to filename.fr.md and filename.de.md. Both french and german languages get generated in their respective subdir, however, and that’s interesting, the en subfolder still gets generated even now where I have nothing in english.
So, I have much simplified my site, removing all unnecessary files, and pushed it on github https://github.com/aubort/loyall. This branch has the issue we are talking about on my side. Hopefully we are going to be able to find out what’s going on.
According to the TOML spec, only maps/dictionaries can follow maps/dictionaries. You can confirm by doing a hugo config, but in your case you get the default, which is en.