Languages and hreflang
The four URL strategies, hreflang and x-default output rules, and language detection.
URL strategies
Choose under Sites → Languages:
| Strategy | Shape | hreflang href |
|---|---|---|
path-prefix (default) | /en/post, /ja/post | https://example.com/en/post |
subdomain | en.example.com/post | https://en.example.com/post |
domain | example.com / example.jp | A domain per language |
none | Single-language site | Canonical only |
Automatic output
For every enabled language the SDK emits:
<link rel="alternate" hreflang="zh-Hans" href="https://example.com/zh-CN/post" />
<link rel="alternate" hreflang="en" href="https://example.com/en/post" />
<link rel="alternate" hreflang="x-default" href="https://example.com/zh-CN/post" />zh-CN maps to zh-Hans, zh-TW to zh-Hant, everything else stays as its BCP 47 tag; x-default points to the site's default language.
Language detection
With data-locale="auto" the SDK detects by strategy: path prefix, subdomain or domain. If nothing matches, the site default is used. You can also pass locale explicitly in page variables.
Missing translations
When a language has no page yet, enable auto translate for it in the console. Until the translation exists the SDK does not emit hreflang for that language, so it never points at a 404.
With Next.js
geoMetadata() writes hreflang into alternates.languages; keep the routing prefix of libraries such as next-intl consistent with the site strategy.