Multilingual Site
A two-language site (English and German) with side-by-side content and translated menus.
File tree #
example-site/
├── config/
│ └── _default/
│ ├── hugo.toml
│ ├── module.toml
│ ├── languages.toml
│ ├── menus.toml
│ └── params.toml
└── content/
├── _index.md
├── _index.de.md
├── about.md
└── about.de.mdConfiguration #
# config/_default/hugo.toml
baseURL = "https://example.com/"
title = "Example site"
enableRobotsTXT = true
defaultContentLanguage = "en"# config/_default/module.toml
[[imports]]
path = "github.com/gohugo-ananke/ananke/v2"# config/_default/languages.toml
[en]
languageName = "English"
languageCode = "en-gb"
weight = 1
title = "Example site"
[de]
languageName = "Deutsch"
languageCode = "de-de"
weight = 2
title = "Beispielseite"# config/_default/menus.toml
[[en.main]]
name = "About"
pageRef = "/about/"
weight = 10
[[de.main]]
name = "Über uns"
pageRef = "/about/"
weight = 10# config/_default/params.toml
[ananke]
show_recent_posts = falseSample content #
+++
title = "Welcome"
+++
This is the English homepage.+++
title = "Willkommen"
+++
Das ist die deutsche Startseite.The about page is translated the same way: content/about.md and
content/about.de.md.
What it looks like #
Hugo serves English at the site root and German under /de/. A language switcher
appears in the header, offering only the languages that have a translation of the
current page. The menu labels are localised per language.
Common adjustments #
- Override theme interface strings per language in
i18n/en.toml/i18n/de.toml(see Multilingual and i18n). - Set a per-language
read_more_copyunder each language’sparams. - Add more languages by adding more tables to
languages.toml.