English
About this handbook

This handbook belongs to the Quartz plugin quartz-multilanguage. And it is built with it: the switcher at the top right comes from there.

This box, too, appears twice in the configuration — once per language.

2.2 – Order and base path

options:
  detection: [folder, suffix, frontmatter]   # default
  defaultLanguage: de

They 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.

FileLanguageBase path
de/notizen/kaffee.mddenotizen/kaffee
en/notizen/kaffee.mdennotizen/kaffee
guide.de.mddeguide
guide.mden (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/kaffee and en/notizen/kaffee — needs no translationKey and no translations. 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.