Filtering the explorer
Left alone, the explorer shows both language trees. Anyone wanting one per language needs a
filter function — and the explorer plugin takes one only through quartz.ts, not through
quartz.config.yaml.
// quartz.ts
import { languageExplorerFilter } from "./.quartz/plugins/quartz-multilanguage";
Explorer({ filterFn: languageExplorerFilter("de", { languages: ["de", "en"] }) });Why this cannot go in the configuration
YAML cannot hold a function. Anything Quartz takes as a function has to go through
quartz.ts— that is a property of Quartz, not a decision of this plugin.
Where the line runs
| The plugin | Quartz |
|---|---|
| detects the language per page | renders <html lang> from it |
| links translations | knows nothing about them |
| renders the switcher | provides the place in the layout |
writes hreflang and og:locale | writes the rest of the head |
| filters languages out of the build | builds what remains |
| — | translates its own interface texts according to locale |
The last line is where most questions hang: what Quartz contributes in words follows the site-wide
locale, not the page’s language. That is not a gap in the plugin but the place where its remit
ends — the way out is one build per language
(8.2).
What every page carries
fileData.multilanguage = { lang, baseSlug, source, translationKey, translations }
Anyone writing their own components finds everything the plugin knows about a page there.