What's on this page
Multilingual
If your pages are available in multiple languages, there are two ways to define them:
Through file name
This is the most common way to translate a page from the main language to another language.
You just need to duplicate the reference page and add the target language code as a suffix, before the extension (e.g.: about.fr.md). The code must be one of the declared languages (format fr or fr-FR).
Example:
├─ about.md # the reference page
└─ about.fr.md # the French version (`fr`)
Through front matter
If you want to create a page in a language other than the main language, without it being a translation of an existing page, you can use the language variable in its front matter.
Example:
---
language: fr
---
Link translated pages
Each translated page references its versions in other languages.
This collection of pages is available in templates with the following variable:
{{ page.translations }}
Search engines
The built-in templates declare translated pages to search engines with hreflang alternates, in the HTML <head> and in the XML sitemap:
- each page lists itself and its translations
x-defaultpoints to the version in the default language, and is omitted when the page has no version in the default language
The XML sitemap lists the pages of all languages, including pages that are not translated into the default language.