site.Sections returns a different collection depending on the language

Dear Hugo community -

I’ve been struggling for some time and maybe this is a trivial mistake but looping through site.Sections gives a different collection depending on the language.

hugo.toml →

defaultContentLanguage = 'en'
defaultContentLanguageInSubdir = true

[languages]
  [languages.en]
    contentDir = 'content/en'
    languageCode = 'pt'
    languageName = 'English'
    title = 'hugo.toml languages.en title'
    weight = 10
    [languages.en.params]
      subtitle = 'hugo.toml languages.en.params subtitle'
  [languages.pt]
    contentDir = 'content/pt'
    languageCode = 'pt'
    languageName = 'Portugues'
    title = 'hugo.toml languages.pt title'
    weight = 20
    [languages.de.params]
      subtitle = 'hugo.toml languages.en.params subtitle'

Then a content structure that is the same for “en” and “pt” languages:

content/{en,pt}/{section1,section2,section3}

With each directory with their own _index.md

Rendering http://localhost:1313/en/ (the default language)

Rendering http://localhost:1313/pt/

This last one (e.g. a site.Sections collection with 3 sections) was the behaviour I hoped to get for both languages.

Could I be missing a configuration setting? It seems to be related to “en” because it’s the default?

Any pointers in the right direction would be much appreciated. Thank you for building Hugo.

Other than the language code being incorrect for the English site, nothing in the above is jumping out at me. Can you share a link to the public repository for your site?

Hi jmooring! Thanks for answering. After your comment I could see the problem:

    [languages.**** de ****.params]
      subtitle = 'hugo.toml languages.en.params subtitle'

it should be “pt”. Hugo is working perfectly well.

Thank you.

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