Skip to main content

Multilingual Sites

A Micropage site can publish the same pages in several languages. Each translated page is an ordinary page block; two meta: keys tell browsers and search engines which language a page is in and which pages are translations of each other.

Page language​

lang: in a page's meta: block sets that page's <html lang="…">:

[Despre -> /ro/despre]
meta:
lang: ro

Use a language code such as ro, fr, or pt-BR. A page without lang: uses the site lang from [site], and en if the site doesn't set one.

Linking translations​

translation: in a page's meta: block points at the same page in another language. Repeat it once per language:

[About -> /about]
meta:
translation: ro -> /ro/despre
translation: fr -> /fr/a-propos
  • Links are made reciprocal automatically: declaring ro -> /ro/despre on /about also links /ro/despre back to /about. Declaring both sides is fine too.
  • Every linked page gets hreflang links in its <head> and in sitemap.xml, plus an x-default entry pointing at the version in the site's default language.
  • A translation: that points at a page that doesn't exist is ignored.

Language folders​

Put each language under its own folder, with the default language at the root:

[Home -> /]
[About -> /about]
[Acasă -> /ro]
[Despre -> /ro/despre]
[Accueil -> /fr]

A first path segment that is a language code (/ro/..., /fr/...) sets the page language automatically when that code is used somewhere in a lang: or translation: line, or the folder holds at least two pages. A single page such as /it/services therefore stays in the site language, so ordinary paths aren't mistaken for languages. Add lang: to a page whenever the folder rule doesn't apply.

What is shared​

The [nav], [footer], and the blog at /content are shared by all languages. A common pattern is a nav link to each language's home page.

Complete example​

An English site at the root with a Romanian version under /ro:

[site]
title: Harbor
description: Boat storage for the winter
lang: en

[nav]
Pricing -> /pricing
Română -> /ro

[Home -> /]
meta:
translation: ro -> /ro

/// hero
h1: Winter storage for your boat
p: Covered, dry, and ten minutes from the marina.
button: See prices -> /pricing

[Pricing -> /pricing]
meta:
translation: ro -> /ro/preturi

/// section
h2: Pricing
table: Per season
| Boat length | Price |
| Up to 6 m | €400 |
| 6 to 9 m | €650 |

[Acasă -> /ro]

/// hero
h1: Depozitare de iarnă pentru barca ta
p: Acoperit, uscat și la zece minute de port.
button: Vezi prețurile -> /ro/preturi

[Prețuri -> /ro/preturi]

/// section
h2: Prețuri
table: Pe sezon
| Lungimea bărcii | Preț |
| Până la 6 m | 400 € |
| Între 6 și 9 m | 650 € |

The Romanian pages need no meta:: the /ro folder sets their language to ro, and the translation: lines on the English pages link them back. Search engines see hreflang="en", hreflang="ro", and hreflang="x-default" (the English page) on each pair.

See SEO for the other per-page meta: keys.