Can't get started with Multilingual Mode

Hi all,

I’m running Hugo 0.126.1.

I’ve copied the example from the docs into /config/_default/languages.yml

defaultContentLanguage: de
defaultContentLanguageInSubdir: true

languages:
  de:
    contentDir: content/de
    disabled: false
    languageCode: de-DE
    languageDirection: ltr
    languageName: Deutsch
    params:
      subtitle: Referenz, Tutorials und Erklärungen
    title: Projekt Dokumentation
    weight: 1
  en:
    contentDir: content/en
    disabled: false
    languageCode: en-US
    languageDirection: ltr
    languageName: English
    params:
      subtitle: Reference, Tutorials, and Explanations
    title: Project Documentation
    weight: 2

I’m getting the errors:

Error: command error: failed to create config from result: failed to decode "languages": 2 error(s) decoding:

* '[defaultcontentlanguage]' expected a map, got 'string'
* '[defaultcontentlanguageinsubdir]' expected a map, got 'bool'

I’ve tried

defaultContentLanguage: { en }
defaultContentLanguageInSubdir: { true }

But that gives me

failed to create config from result: failed to decode "languages": config value "en" for defaultContentLanguage does not match any language definition

Have I missed something?

No.

Your example belongs in the root config file.

Oh okay, I wasn’t using a root config file, all my configs were in /config/_default.

Thanks for clearing that up.

That’s fine.

config/
└── _default/
    └── hugo.toml  <-- root config file

You put what should be in config/_default/hugo.toml into /config/_default/languages.yml.

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