hreflang for translated pages
On this page
hreflang tags tell search engines that several addresses are the same page in different languages. They only make sense when each language has its own address.
The rules#
- Every version lists all versions, including itself.
- Addresses are complete, starting with
https://. - Language codes are standard codes such as
frorpt-BR. x-defaultnames the fallback page for visitors whose language is not listed.- Google supports these as HTML tags, as HTTP headers, or inside a sitemap, and treats them as equivalent. See Google's guide to localized versions.
What the product writes#
- WordPress: a full, matching set in the head of every translated page.
x-defaultis the source-language page, or a setting you choose. - Framework kits and static sites: the same set, written at build time, with an optional sitemap that lists all versions.
- Shopify: Shopify writes them.
Codes that are left out#
Google does not support region-only codes or numeric regions such as es-419. The product leaves them out of the tags.
Pages that are left out#
Pages with too little translated text are left out of the set in both directions. See Thin pages.
Adding them by hand#
If you publish real language pages yourself and can edit the head of each page, add the same full set to every version. The repository's snippet tool has a command that prints the tags from a list of addresses. If you cannot edit the head, use a sitemap with alternate links instead.
Do not double up#
Wix, Webflow and Squarespace write hreflang in their own multilingual features. Do not add the same tags by hand on top of those. Look at the page source first.
The script tag#
The script tag creates no new addresses, so there is nothing to annotate.