Hreflang: A Practical Guide For Multi-Country Sites
Hreflang is the mechanism that tells a search engine which page is the equivalent of this one in a different language or country, and it is the single most commonly mis-implemented international SEO feature. The implementation is small; the failure modes are numerous, and almost all of them fail silently because an ignored annotation produces no error. This guide covers what the annotation actually asserts, where it can live, the specific mistakes that cause it to be dropped, and how to check your implementation against real query data rather than a validator.
What hreflang is, and what it is not
Hreflang is a set of reciprocal annotations declaring language and regional targeting between URLs. Read as a set, it says: these URLs serve the same content in different languages or for different markets, and each one should serve the appropriate version to users in that market.
Four things it is not:
| Common belief | Reality |
|---|---|
| It is a directive to Google | No. It is an annotation, and inconsistent annotations are discarded |
| It replaces canonical tags | No. Canonical and hreflang solve different problems and both are needed |
| It is set per URL without reciprocity | No. It is a cluster, and a cluster with a missing link is broken |
| It helps rankings | Indirectly, by preventing the wrong language being served |
That last one is the real commercial effect. Without hreflang, a French page may be served to a French-language query in English, with a lower click-through rate and a signal that the site is not relevant to that market. Hreflang does not make your French page rank; it stops your English page being served when the French page was the right answer.
An hreflang cluster is a graph, not a list. Every annotation needs at least one return annotation, and the graph has to be complete.
The annotation structure
A correct three-way cluster, with each page declaring itself and both alternates:
<link rel="alternate" hreflang="en-gb" href="https://example.com/en-gb/product/12345">
<link rel="alternate" hreflang="fr-fr" href="https://example.com/fr-fr/produit/12345">
<link rel="alternate" hreflang="de-de" href="https://example.com/de-de/produkt/12345">
<link rel="alternate" hreflang="x-default" href="https://example.com/product/12345">
Three structural requirements are non-negotiable:
- Self-reference. Every page in the cluster must include an annotation pointing to itself.
- Reciprocity. If the English page lists the French page, the French page must list the English page.
- Absolute URLs. Relative paths are not supported here. Every
hrefis fully qualified, including the scheme.
x-default is optional and frequently misunderstood. It is not "the default language version". It is the annotation for users whose language matches no other entry, and it should point at your language selector or global entry page, not at English. If you only serve one language and one country, you do not need hreflang at all.
Language and country codes
| Situation | Correct code | Notes |
|---|---|---|
| Global English, no country targeting | en | Valid, and simpler than inventing countries |
| English, United Kingdom only | en-gb | Region implies language here |
| French, France | fr-fr | Language lower-case, region upper-case |
| Belgian Dutch and Flemish French | nl-be, fr-be | Language plus region, never a made-up combination |
| Spanish across Latin America | es | Then use es-mx and es-es only if the content genuinely differs |
The rule of thumb: only add a regional suffix when the content actually differs for that region. Splitting es into twenty country codes because you have one shipping page is annotation for its own sake, and it multiplies the maintenance cost of every cluster on the site.
Where the annotations can live
| Method | Works? | Notes |
|---|---|---|
link rel="alternate" in head | Yes | The usual choice, easy to inspect |
HTTP Link header | Yes | Useful when head is generated by a third party |
XML sitemap xhtml:link entries | Yes | Google's documented approach, scales well |
| JavaScript-injected links | Occasionally | Injection is a recognised pattern but not first choice |
| Body-placed links | No | Ignored |
For a site with hundreds of thousands of URLs, the sitemap approach has a real operational advantage: the annotations live in one generated artefact, version-controlled alongside the sitemap itself, and you can diff them across deploys. The downside is that it needs a build step and it will drift if the page templates change without the sitemap being regenerated.
Here is the sitemap form:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/en-gb/product/12345</loc>
<xhtml:link rel="alternate" hreflang="en-gb"
href="https://example.com/en-gb/product/12345"/>
<xhtml:link rel="alternate" hreflang="fr-fr"
href="https://example.com/fr-fr/produit/12345"/>
<xhtml:link rel="alternate" hreflang="de-de"
href="https://example.com/de-de/produkt/12345"/>
<xhtml:link rel="alternate" hreflang="x-default"
href="https://example.com/"/>
</url>
</urlset>
How annotations get silently dropped
This is the part that matters on a large site, because each of these produces no error message anywhere.
| Mistake | Result |
|---|---|
| Missing self-reference | Entire cluster may be ignored |
| One-way annotation from a single page | Cluster treated as incomplete |
| Return-tag points to a redirecting URL | Target ignored; cluster breaks |
| Return-tag page is noindexed | Target ignored |
| Return-tag canonicalises elsewhere | Target ignored |
| Language code not a valid ISO 3166-1 or BCP 47 value | Entry ignored |
| Relative URLs | Entry ignored |
| Annotations added by a tag manager after load | Unreliable, frequently dropped |
| Cluster built from a CMS field nobody fills in | Partial clusters across most of the site |
noindex on a localised URL | Page cannot be served to its target market |
The sixth and seventh rows deserve emphasis on a large site. An annotation pointing at a 301, a noindex page, or a canonicalised duplicate is treated as not existing. On an ecommerce site with twelve language variants and a decade of URL history, this is not a rare edge case; it is the default state unless someone actively reconciled the annotations against live response codes.
Verification, at the population level
Validator tools are necessary and insufficient. They check one URL against the annotations found in its response, which catches syntax errors and missing self-references, and nothing else.
| Check | What it catches |
|---|---|
| hreflang validator, per template | Syntax, self-reference, missing reciprocals |
| Fetching the return-tag URL and checking its status | Redirect and dead-end targets |
| Comparing annotated clusters to canonical clusters | Conflicting signals |
| Search Console international targeting report | Clusters Google actually accepted |
| Query data split by country | Whether it is working commercially |
Only the fourth confirms acceptance, and it is reported per cluster, which means your real task is to get from "one URL validated" to "the report shows a healthy share of clusters recognised". That is a sampling problem, and it is much closer to the rest of this site's subject matter than it first appears: the annotated URL set, the canonical URL set and the crawlable URL set are three lists that should be reconciled before anything is concluded.
What does not work
Adding hreflang to a site that has one language. You have added an annotation with nothing to annotate.
Generating annotations from the URL structure alone. The fact that a path segment reads /fr-fr/ does not mean the French page exists, is canonical, or is indexable. Generate from what actually resolves.
Rebuilding clusters on every content change. Clusters should be rebuilt when the URL set or the language mapping changes. Rebuilding them hourly across a large site produces churn and no benefit.
Treating the validator's green tick as evidence of indexing. A valid cluster is a well-formed claim. Whether it is honoured is a separate question answered by Search Console and by traffic.
Fixing hreflang before fixing indexation. Annotations on pages that are not indexed cannot do anything. Establish that the localised URLs are crawled and indexable first, then annotate.
Where to start
Export the three lists: your canonical URLs, your indexable URLs, and your annotated alternates. Reconcile them. The rows that differ are your real work, and they are typically a few per cent of a large site, which is a tractable engineering task rather than an open-ended one.
Then validate three clusters: a popular page, a long-tail page, and a page with a complicated history of redirects. The third is where your actual bugs will be.
To get the URL set that the export should be based on, run the crawl first — running and monitoring crawls covers the setup, and site configuration covers how country and language variants should be scoped. For reconciling the differences by pattern rather than by URL, triage and pattern analysis is the section that explains the method, and prune SEO's URL pattern clustering describes how the grouping is produced.