First Step to Multilingual - one language in its subdir - How to do this?

Hi all,
I built up my website xlateral.ch over the last two years. A multilingual configuration with only the first language activated. It’s done with Hugo and UiKit.
So I got:

xlateral.ch/ (lang independent files)
xlateral.ch/de (active de content)
xlateral.ch/en (empty)

Now I do a refactoring and bring it to xlateral.com. I will make a translation to en in next months or so.

Here is my question to sitemap and sitemapindex in this setting.
Q: At the moment I set disableLanguages = [“en”] then my output is going flat to the root. When I strip ‘disableLanguages = [“en”]’ away then I get the layout above back.
I would like to see always and stable:
xlateral.ch/ (lang independent files)
xlateral.ch/de (active de content)
And after translation the additional “xlateral.ch/en”

– Here my config.toml (language parts) –

disableLanguages = ["en"]
DefaultContentLanguage = "de"
DefaultContentLanguageInSubdir = "true"

[languages]
[Languages.de]
languageName = "De"
languageCode = "de"
contentDir = "content/de"
weight = 1
[Languages.en]
languageName = "En"
languageCode = "en"
contentDir = "content/en"
weight = 2
[languages.en.params]
description = "xxx en"

I tried many combinations. So if someone has an experience it would be really helpful!

Best,
Ueli

I think you are running into this known defect:
https://github.com/gohugoio/hugo/issues/10064

Hi jmooring,
thank you for the hint!
Yes, it looks exactly like this bug.

So, I will do a manual workaround. It’s not a big thing for some time.
Problem “solved”!

Best,
Ueli

I think you could add this (a dummy langauge) to workaround the problem:

[languages.xx]
contentDir = 'content/xx'
disableKinds = ['home','page','section','taxonomy','term','RSS','sitemap']
weight = 99

Perfect, an automatic workaround.

I checked it. What is left at the end is:
The default iterates over the languages and produces links to “de” and “en”.
So, a modified sitemapindex template would do eventually the job?

I’ve a final automatic solution.
Strip the “en” link in the index sitemap.xml.
Then move it to the static directory.

After a build, I have three things:

xlateral.com with the modified index sitemap.xml in the root
xlateral.de with the "de" sitemap.xml
no "en" directory.

Just perfect :slight_smile:

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