Multilingual
The Relearn theme works with Hugo’s multilingual mode.
It supports many languages, including right-to-left languages.
Translation by File Name
Here’s how to make your site multilingual using translations by file name:
-
Set up languages in your
hugo.toml
file:hugo.defaultContentLanguage = 'en' [languages] [languages.en] languageCode = 'en' languageName = 'English' title = 'My Website' weight = 1 [languages.pir] languageCode = 'art-x-pir' languageDirection = 'rtl' languageName = 'Pirrratish' title = 'Arrr, my Website' weight = 2
defaultContentLanguage: en languages: en: languageCode: en languageName: English title: My Website weight: 1 pir: languageCode: art-x-pir languageDirection: rtl languageName: Pirrratish title: Arrr, my Website weight: 2
{ "defaultContentLanguage": "en", "languages": { "en": { "languageCode": "en", "languageName": "English", "title": "My Website", "weight": 1 }, "pir": { "languageCode": "art-x-pir", "languageDirection": "rtl", "languageName": "Pirrratish", "title": "Arrr, my Website", "weight": 2 } } }
-
Duplicate your content files and add language codes to their file names:
βββ content β βββ first-chapter β β βββ first-page | | | βββ _index.en.md | | | βββ _index.pir.md β β βββ second-page | | | βββ index.en.md | | | βββ index.pir.md β β βββ third-page.en.md β β βββ third-page.pir.md β βββ _index.en.md β βββ _index.pir.md βββ themes β βββ hugo-theme-relearn β βββ ... βββ hugo.toml
Translation by Content Directory
The theme also support translations by content directory which can be configured in a similar way. This is not used in further examples of this documentation.
Search Settings
Check the search configuration for multilingual options.
Turn Off Language Switching
Option By default the theme shows a language switcher in the lower part of the menu.
To disable the language switcher set disableLanguageSwitchingButton=true
hugo.
[params]
disableLanguageSwitchingButton = true
params:
disableLanguageSwitchingButton: true
{
"params": {
"disableLanguageSwitchingButton": true
}
}