dev-tools
Glossary ↗hreflang
hreflang is the annotation that tells a search engine a page has equivalent versions in other languages or for other regions, and which is which. It can be declared with link elements in the document head, with HTTP Link headers, or inside an XML sitemap; the sitemap is usually the easiest to keep correct, because the whole mapping lives in one generated file rather than being repeated across every page in every locale. The mechanics are unforgiving in one specific way: the set has to be reciprocal. Every page in a language group must reference every other page in the group, itself included. A version that is linked to but does not link back is generally ignored, and because the failure produces no error anywhere, an incomplete set behaves exactly like no annotation at all. An x-default entry names the version to serve when no listed language fits the visitor. The codes are the other reliable source of mistakes. The language is an ISO 639-1 code, optionally followed by an ISO 3166-1 Alpha-2 region — so en-GB rather than en-UK, and the point that catches people, uk on its own is the Ukrainian language and not the United Kingdom. A region alone is never valid; the language part is mandatory. It is worth being clear about what hreflang does not do. It is not a ranking signal and it does not consolidate anything: two translations remain two pages competing on their own merits in their own markets. It also does not resolve duplication — each localised page should carry a canonical pointing at itself, and a canonical that points from one language to another cancels the annotation entirely. The failures worth checking for are all structural rather than editorial: annotations pointing at URLs that redirect, 404 or carry noindex; a set that grows a new locale in the routing but not in the sitemap; and translated pages generated at a URL the annotation does not know about. Generate the mapping from the same source as your routes and the whole class of problem disappears.
Related terms