Language
Hugo supports using multiple languages in the same site [1] [2]
To use a language other than English in a site:
Setup
- Add a line languageCode = “<lang-code>” to
config.toml
:
languageCode = "es"
- Create a file
<lang-code<.yaml
in thei18n/
folder, for examplei18n/es.yaml
.
Use
- Replace the English text in the template with a call to
i18n
with “id” as a parameter. For example, the text Table of Contents is replaced with this:
{{ i18n "TableOfContents" }}
- Add the id and a translated text to the language file. For the
above example, add these lines to file
i18n/es.yaml
:
TableOfContents:
other: Índice de Contenido