Main language and defaultContentLanguage don't match

Hi there, thank you for providing hugo to the world, it’s an amazing tool!

During the past week, I’m battling a “simple” language issue and I’m genuinely stuck right now. I want “/” to be a different language than en.

The problem is that defaultContentLanguage variable seems to be ignored:

DEBUG 2023/02/10 11:54:34 Write redirect to main language en: https://...
DEBUG 2023/02/10 11:54:34 creating alias: en redirecting to https://...

I tried defaultContentLanguageInSubdir set to true and false, I tried reorganize content with contentDir and without, but hugo still makes en my main language.

My current config:

defaultContentLanguage = "cs"
defaultContentLanguageInSubdir = false
  languageCode = "cs"
  weight = 1
  contentDir = 'content/cs'
  title = "..."
  languageCode = "en"
  weight = 2
  contentDir = 'content/en'

The truth is that I don’t even need the en translation because the site will only be in cs.

├── cs
│   ├──
│   └── post
│       ├──
│       └──
└── en

4 directories, 5 files

(en/about literally says there is no en content)

I am using GitHub - xianmin/hugo-theme-jane: A readable & concise theme for Hugo


hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168+extended linux/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio

I’d be grateful for any suggestions, thank you.

Have you already checked if sorting this in the baseof template makes any difference?

<html lang="{{ $.Site.LanguageCode | default "en" }}" itemscope itemtype="">
1 Like

also, typos in the theme config?
Screenshot 2023-02-10 164420

1 Like

Rename cs/ to cs/

1 Like

Thank you @frjo, @andrewd72! I tried your suggestions but nothing changed. Instead it made it clear there is something wrong with the language setup.

This lead me, again, to this post [SOLVED] DefaultContentLanguage does not seem to work - #8 by bep and I realized the symptoms are identical. :person_facepalming: And the solution.

I am going to change from toml to yaml.

1 Like

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