options:
detection: [folder, suffix, frontmatter] # default
defaultLanguage: deThey are tried in that order, and the first match wins. A file de/guide.en.md therefore belongs
to de when folder comes before suffix — the folder was there first.
Turning that around turns the result around:
options:
detection: [suffix, folder, frontmatter]An empty list (detection: []) assigns everything to the default language. That is not an
accident but the way to switch detection off and link everything by hand through translations.
When nothing matches
Then defaultLanguage applies. Without one that is the first language in languages — an order
easily overlooked when a language is later moved to the front.
The base path
Every detection yields not only the language but also the base path: the slug without the language part.
| File | Language | Base path |
|---|---|---|
de/notizen/kaffee.md | de | notizen/kaffee |
en/notizen/kaffee.md | en | notizen/kaffee |
guide.de.md | de | guide |
guide.md | en (default) | guide |
It is the thing that really matters, because three things rest on it: the tacit linking through identical paths (chapter 3), the fallback redirects and the link rewriting.
Identical base paths save all configuration
Anyone naming their files the same in both languages —
de/notizen/kaffeeanden/notizen/kaffee— needs notranslationKeyand notranslations. The link follows by itself. Only translated file names (en/notes/coffee) have to be spelled out.
What every page carries afterwards
fileData.multilanguage = {
lang, baseSlug, source, translationKey, translations
}
source says which of the three ways applied — useful when a page unexpectedly ends up in the wrong
language. In addition frontmatter.lang is set if it is missing; Quartz makes <html lang> out of
it.