What Is the hreflang attribute and why it matters
The hreflang attribute informs search engines about the language targeted by each URL. By placing alternate-link tags in the <head> section, you guide Google to serve the correct version of a page to users based on their language preferences or geographical location. Proper hreflang implementation reduces bounce rates, improves engagement, and consolidates SEO signals across localized pages.
Why Use “en” as your global default
The x-default value acts as a universal fallback within your set of hreflang tags. Rather than targeting a specific locale, x-default designates which URL to serve when none of the language-region codes match a user's settings. Including x-default prevents users from being directed to irrelevant pages and helps search engines index your preferred version.
For example, if a Chinese visitor lands on your website but you don't have a Chinese-language page, Google will serve them the URL designated by x-default typically your English version. This ensures the user sees comprehensible content rather than being randomly assigned to a German or French page they can't understand. The x-default tag acts as your safety net, guaranteeing that unsupported languages receive the most universally accessible version of your content.
Understanding x-default and its purpose
The x-default value acts as a universal fallback within your set of hreflang tags. Rather than targeting a specific locale, x-default designates which URL to serve when none of the language-region codes match a user’s settings. Including x-default prevents users from being directed to irrelevant pages and helps search engines index your preferred version.
Typical x-default setup example
<link rel="alternate" hreflang="en" href="https://example.com/en/">
<link rel="alternate" hreflang="de" href="https://example.com/de/">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/">
<link rel="alternate" hreflang="x-default" href="https://example.com/en/">
How x-default operates in practice
When a user whose browser language is Chinese visits your site without a Chinese version, Google serves the URL designated by x-default (English). This ensures users see meaningful content rather than an untranslated homepage or an unintended localized page.
SEO risks of missing x-default
- indexing ambiguity - crawlers may arbitrarily select a version to index, splitting link equity,
- poor user experience - visitors without a matching language tag land on irrelevant pages or generic homepages, increasing bounce rates.
- traffic loss - lower engagement from misdirected users reduces conversions and can negatively impact search rankings over time.
Why region codes matter - and when to use generic tags
Region-specific codes like de-DE (Germany) and de-AT (Austria) should be applied only if you deliver distinct content for each market. Differences might include pricing, legal terms, shipping options, or dialectal adjustments. However, if both regions share identical content, separate regional URLs risk triggering duplicate-content penalties. In such cases, use the generic language code without region qualifiers:
<link rel="alternate" hreflang="de" href="https://example.com/de/">
<link rel="alternate" hreflang="x-default" href="https://example.com/en/">
This approach serves all German-speaking visitors the same content while preserving SEO value.
Common pitfalls in multilingual plugins (e.g., Polylang)
Many WordPress plugins automate hreflang generation, but misconfigurations are frequent:
- Hreflang links in
<body>- plugins may inject alternate links into the page body rather than the head, causing search engines to ignore them or misinterpret signals. - Inconsistent head vs. body tags - discrepancies between tags in
<head>and<body>lead to conflicting instructions for crawlers, resulting in indexing errors. - Omitted x-default - out-of-the-box plugin settings often lack an
x-defaulttag, leaving no universal fallback URL. - Incorrect language codes - using nonstandard or lowercase codes (e.g.,
en-usinstead ofen-US) can prevent search engines from recognizing tags correctly. - Missing self-referencing tags - each localized page must include a self-referencing hreflang tag. Omitting it breaks the bidirectional link structure required by Google.
Step-by-Step Best Practices for Hreflang Implementation
- Place tags in
<head>only - ensure all<link rel="alternate">tags appear in the head section to guarantee crawler recognition. - Verify with manual inspection - after setup, view page source to confirm that alternate tags match your intended language-region combinations and include
x-default. - Use ISO-compliant codes - follow ISO 639-1 for language and ISO 3166-1 Alpha 2 for region codes (e.g.,
en,de,fr-FR,es-ES). - Consolidate identical content - if content is identical across regions, use the generic language tag instead of separate region codes to avoid duplication issues.
- Include self-referencing links - every page should include an hreflang tag for itself, maintaining a closed set that links all variants, including
x-default. - Monitor performance metrics - track bounce rates, time on page, and organic traffic per region to validate that your hreflang strategy improves user engagement.
Why relying on sitemaps for hreflang is risky
Using hreflang solely in XML sitemaps might seem efficient for large sites, but it introduces inconsistency. Search engines expect alternate links to appear in the page <head>. When hreflang annotations exist only in sitemaps or only in templates, crawlers may ignore them or fall back to undisclosed algorithms. This unpredictability can lead to incorrect language targeting, reduced visibility in search results, and a phenomenon known as “stranger things,” where Google serves unintended page versions.
Always place hreflang tags in the <head>
Embedding all hreflang tags directly within the HTML <head> of each variant ensures a single, authoritative source of language targeting signals. Benefits include:
- immediate recognition - crawlers parse
<head>tags first, guaranteeing hreflang is read before any other markup, - eliminated conflicts - a unified location prevents mismatches between sitemaps and page templates,
- consistent indexing - Google receives clear, unambiguous instructions, reducing the risk of fallback to unknown methods.
No SEO Upside to duplication
There is no incremental benefit from having hreflang in both sitemaps and <head>. Duplicate entries raise maintenance overhead and create opportunities for errors mismatched URLs, missing self-references, or forgotten x-default tags. By centralizing hreflang in the <head>, you maintain complete control over your language logic and eliminate the chance of divergent signals.
Guarding against Google’s fallback algorithms
When hreflang implementation lacks consistency, Google may choose to ignore your annotations and rely on its own geotargeting heuristics. This can result in:
- unexpected drops in traffic - sudden ranking shifts in key markets with no clear cause,
- user misdirection - visitors see the wrong language page,
- Fragmented link equity - backlinks and rankings spread across unintended variants.




