International SEO
The web is not in one language. Someone in Paris searches in French. Someone in Pune searches in Hindi or English. Someone in Lagos, Lima, or Lahore searches in their own words too, in their own way, with their own spellings, prices, and habits.
If your site speaks to more than one of them, international SEO is how you tell search engines (and browsers, and screen readers) which version is for whom. Done well, a reader sees your page in the right language. Done badly, a French reader lands on your English page, and a Hindi reader never finds your Hindi one at all.
This is the last lesson in the SEO section, and it ties together almost everything before it: titles, descriptions, canonical links, and Open Graph tags, all repeated, for every language.
What You Will Learnβ
- The difference between a language and a region
- The
langattribute, and what it is for - How to use
hreflanglinks, includingx-defaultand return links - The right codes (and the common wrong ones)
- How to choose a URL structure
- How canonical, titles, and Open Graph fit with each version
- Localisation beyond translation
- How to check your setup
The Big Ideaβ
- HTML Code
- hreflang Builder
<!doctype html>
<html lang="en">
<head>
<title>Rye Bread Recipe | The Bread Bin</title>
<link rel="canonical" href="https://thebreadbin.example/recipes/rye-bread">
<link rel="alternate" hreflang="en" href="https://thebreadbin.example/recipes/rye-bread">
<link rel="alternate" hreflang="en-GB" href="https://thebreadbin.example/uk/recipes/rye-bread">
<link rel="alternate" hreflang="fr" href="https://thebreadbin.example/fr/recettes/pain-de-seigle">
<link rel="alternate" hreflang="hi" href="https://thebreadbin.example/hi/rye-bread">
<link rel="alternate" hreflang="x-default" href="https://thebreadbin.example/recipes/rye-bread">
</head>
One row for each version of the page, including the page you are on.
Put this same block in the head of every version:
<link rel="alternate" hreflang="en" href="https://thebreadbin.example/recipes/rye-bread">
<link rel="alternate" hreflang="en-GB" href="https://thebreadbin.example/uk/recipes/rye-bread">
<link rel="alternate" hreflang="fr" href="https://thebreadbin.example/fr/recettes/pain-de-seigle">
<link rel="alternate" hreflang="hi" href="https://thebreadbin.example/hi/rye-bread">
<link rel="alternate" hreflang="x-default" href="https://thebreadbin.example/recipes/rye-bread">
Or put it in your sitemap, for this page:
<url>
<loc>https://thebreadbin.example/recipes/rye-bread</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://thebreadbin.example/recipes/rye-bread"/>
<xhtml:link rel="alternate" hreflang="en-GB" href="https://thebreadbin.example/uk/recipes/rye-bread"/>
<xhtml:link rel="alternate" hreflang="fr" href="https://thebreadbin.example/fr/recettes/pain-de-seigle"/>
<xhtml:link rel="alternate" hreflang="hi" href="https://thebreadbin.example/hi/rye-bread"/>
</url>
0 things to check.
No problems found by these simple checks.
Try changing a code to en-UK, jp, or fr_FR, and see the advice. The sitemap form also needs the xhtml namespace on the urlset element, and one block per page. Use one method (tags, headers, or sitemap), and keep it consistent. Search engines treat hreflang as a hint.
Edit the codes and addresses. Try the common mistakes, and watch the advice change.
Language, Region, and Scriptβ
A language is what people speak and read. A region is where they live. They are not the same, and sometimes both matter.
| Code | Meaning | Why you might separate them |
|---|---|---|
en | English, any region | One English version for everybody |
en-GB | English for the United Kingdom | Spelling (colour), currency (pounds), units |
en-US | English for the United States | Spelling (color), currency (dollars) |
pt-BR | Portuguese for Brazil | Different words and grammar from Portugal |
zh-Hans and zh-Hant | Chinese, simplified and traditional script | Different writing systems |
fr | French, any region | One French version for everybody |
You do not need a region for every language. Add one only when the content really differs, such as prices, laws, spelling, or shipping.
The codesβ
- Language: two or three lowercase letters, from the ISO 639 list (
en,fr,hi,ja). - Region: two uppercase letters, from the ISO 3166-1 list (
GB,US,IN,BR). - Script (rare): four letters with a capital first, such as
HansorHant. - Separator: a hyphen, never an underscore:
en-GB, noten_GB. - Region alone is not allowed.
GBis not a code. You need the language:en-GB.
Common wrong codes: en-UK (it should be en-GB), jp (it should be ja), cz (should be cs), gr (should be el), ua (should be uk), and fr_FR with an underscore.
The lang Attributeβ
<html lang="fr">
The lang attribute on the html element says what language the page is written in. It matters for:
- Screen readers, which choose the right voice and pronunciation.
- Browsers, for hyphenation, spell-check, quotation marks, and font choices.
- Translation tools, which can offer or skip translation.
- Styling, with the
:lang()CSS selector.
Search engines mostly work out a page's language from its text, and do not rely on lang for it. So lang is not a ranking tool, but you should always set it, for people. For a passage in another language, put lang on that element:
<p>The French call it <span lang="fr">pain de seigle</span>.</p>
For right-to-left languages, add dir="rtl" as well: <html lang="ar" dir="rtl">.
hreflang: Pointing to Your Other Versionsβ
hreflang tells search engines: "This page has the same content in these other languages and regions, here are the addresses." They can then show each reader the version that matches them best.
<link rel="alternate" hreflang="fr" href="https://thebreadbin.example/fr/recettes/pain-de-seigle">