hreflang annotation
hreflang tells search engines which page version to serve for users in a specific language or region.
An hreflang annotation pairs a language (and optional region) code with a URL: <link rel="alternate" hreflang="es" href="https://example.com/es/page">. Google reads the full set of annotations on a page and decides which variant to surface based on the searcher's locale signals. Done right, it lets a Spanish page rank in Spain while the English version ranks in the US — both inherit each other's authority instead of competing.
The failure modes are unforgiving. Annotations must be reciprocal: if /en lists /es, then /es must list /en, or Google silently drops the pair. Every page in the cluster must include a self-reference (the page must list itself). Codes follow ISO 639-1 (language) and ISO 3166-1 Alpha 2 (region) — common mistakes like en-UK (use en-GB) invalidate that entry. The canonical URL on each page must match one of its own hreflang URLs, otherwise Google discards the entire cluster.
Three placement methods work, but they must agree if you use more than one: <link> tags in the HTML head, an HTTP Link header, or <xhtml:link> entries inside an XML sitemap. For sites with 10+ locales the sitemap variant is usually cleanest because it doesn't bloat each page. Validate with the hreflang validator before pushing — silent failures here are common.