Flag of Puerto Rico
Start with English, expand with Spanish
This template shows how to match English and Spanish content, translate navigation, and wire the built-in language toggle.
Welcome
Canopy renders every locale from the same IIIF data and content tree. In this template example, the English language site lives at content/ while the additional locale for Español (Spanish) lives under content/<lang>/ as content/es/. Matching file paths lets Canopy infer which translation to load when visitors switch languages.
Extend locales
- Edit
canopy.ymland add entries underlocales. Mark one locale asdefault: true. - Each locale should include a
label(used by the toggle) and the BCP 47langcode that matches your content. - Save and rerun
npm run dev/npm run buildso the builder reloads the config.
Mirror content
- Translate MDX pages under
content/<lang>/…using the same file names as the default locale (content/index.mdx⇄content/es/index.mdx). - When a localized file is missing, Canopy falls back to English, so you can add translations incrementally.
- Use frontmatter to override
title,description, orlangper locale.
Localize UI strings
- Copy
content/locale.ymltocontent/<lang>/locale.ymland translate the values. - Update
routes.searchorroutes.worksto change slug segments such as/es/buscaror/es/obras. - Update
content/<lang>/navigation.ymlto translate menu labels or point links at localized paths.


