Γ—
Home RSS feed info
i18n - hugo.toml changes as of Hugo 0.112

Multilingual - Changes in Hugo as of version 0.112

Multilingual - Changes in Hugo as of version 0.112

As of Hugo 0.112, some i18n changes in the hugo.toml for a multilingual website must be observed. Currently, only deprecated warnings are issued when starting with hugo server. Depending on the size of the terminal window, the warnings may not be visible at first glance.

As yet, the website is being created without termination. But in a future version this will no longer be possible. So it is time to act. The Hugo team has published the following notes:

What needs to be changed for a multilingual Hugo website from version 0.112?

The header image of this post shows the warnings that the Hugo generator gave me. In all 4 cases, the warnings refer to the file hugo.toml. For each language, 2 parameters are objected to - description and mydomain.

The parameters mentioned in the warnings do not belong to the site variables. See this - Hugo Documentation - Site Variables . This is the key to the warnings.

Before Hugo Version 0.112

Below is the corresponding extract from the hugo.toml:

..
defaultContentLanguage = "de"
[languages]
  [languages.de]
    languageName = "Deutsch"
    weight = 1
    title = "Hugo, Webdev, SEO, Tools"
    description = "Blog ΓΌber Hugo, Webdev, SEO, Tools"
    mydomain = "tekki-tipps.de πŸ‡©πŸ‡ͺ"
..
  [languages.en]
    languageName = "English"
    weight = 2
    title = "Hugo, Webdev, SEO, Tools"
    description = "Blog about Hugo, Webdev, SEO, Tools"
    mydomain = "tekki-tipps.de/en πŸ‡¬πŸ‡§"
..

As of Hugo Version 0.112

The new structural adjustment in the file hugo.toml looks like this:

..
defaultContentLanguage = "de"
[languages]
  [languages.de]
    languageName = "Deutsch"
    weight = 1
    title = "Hugo, Webdev, SEO, Tools"
    [languages.de.params]
      description = "Blog ΓΌber Hugo, Webdev, SEO, Tools"
      mydomain = "tekki-tipps.de πŸ‡©πŸ‡ͺ"
..
  [languages.en]
    languageName = "English"
    weight = 2
    title = "Hugo, Webdev, SEO, Tools"
    [languages.en.params]
      description = "Blog about Hugo, Webdev, SEO, Tools"
      mydomain = "tekki-tipps.de/en/ πŸ‡¬πŸ‡§"
..

description and mydomain are not site variables. Therefore, as of Hugo version 0.112, they must be marked with [languages.de.params] and [languages.en.params] in the hugo.toml structure.

I didn’t have to change anything in the source code of the templates, partials and shortcodes. There, the parameters could only be used via {{ .Site.Params.description }} and {{ .Site.Params.mydomain }}.

Checking the Hugo Release Notes

Until now, I have rarely actually read the release notes of Hugo versions. In this case, I became aware of the change through a post on a Mastodon instance. In future, I will take a closer look at the release notes before upgrading to a new Hugo version.

Conclusion

The changes to the site are minimal in my case. Once you understand what the notes - Changes in Hugo 0.112.0 - from the Hugo team mean, the changeover is quickly done. The changes in my older blog posts, on the other hand, are more extensive, as I have written a lot about Hugo and Multilingual. I will mark the changes in my older blog posts accordingly.

Link list for this article

This might also interest you

|
3 minutes to read
0
This post was created with Hugo version 0.115.2.

With the German language setting, comments are not displayed in the English version of the website and vice versa.

© 2023 - Frank Kunert  -  About me