Hreflang is an HTML attribute used to tell search engines which language and geographical region a specific page targets. It helps Google serve the correct version of a page to users based on their language and location, preventing duplicate content issues between translated or region-specific versions of the same content.
How Hreflang Works
- Syntax: <link rel="alternate" hreflang="en-us" href="https://example.com/us/page">
- Language codes: ISO 639-1 format (en, es, fr, de, etc.)
- Region codes: Optional ISO 3166-1 Alpha 2 (us, gb, au, etc.)
- x-default: Specifies the fallback page for unmatched languages/regions
- Bidirectional: Each language version must reference all other versions, including itself
Key point: Hreflang is one of the most technically complex SEO implementations. The most common error is missing return tags - every page must reference every other language version, and each of those pages must link back. A single missing return tag can break the entire hreflang setup.
Implementation Methods
- HTML head: Link tags in the head section of each page
- HTTP headers: For non-HTML files like PDFs
- XML sitemap: Using xhtml:link elements in the sitemap
Why It Matters for SEO
Without hreflang, search engines may show the wrong language version of your content to users, or treat translated versions as duplicate content. For any website targeting multiple countries or languages, hreflang is essential for ensuring the right content reaches the right audience and that ranking signals are properly attributed to each version.