Glossary

What is x-default?

x-default is the hreflang value Google documents for the page to show when none of the other language or region codes matches the searcher’s browser settings. It is not a language, and it does not tell Google what language the page is written in. Google says it uses its own algorithms for that, not the hreflang value and not the HTML lang attribute.

Check this on your site

When hreflang is present, the checker warns if x-default is missing or if alternate URLs are not absolute.

Copy-paste example

<link rel="alternate" hreflang="en" href="https://audacian.eu/" />
<link rel="alternate" hreflang="es" href="https://audacian.eu/es/" />
<link rel="alternate" hreflang="x-default" href="https://audacian.eu/" />

audacian.eu publishes English with no prefix and Spanish, Romanian and French under /es, /ro and /fr. Every indexable page lists its alternates with hreflang, including itself, and an x-default whose href is the English URL. The sitemap carries the same alternates. Pages that exist only in English list English and x-default. The language used to live in the browser, on one URL. The routing middleware does not redirect crawlers by country, so each language stays at its own URL for them to read.

Google’s localized-versions documentation says hreflang tells Google that a set of URLs are language or region variants of the same content, so it can point a searcher at the version that fits. Each version must list itself and the others. The URLs must be absolute, including https. If two pages do not point at each other, Google says the tags can be ignored, so that some other site cannot declare itself an alternate of yours. The same set can be written in the HTML head, in HTTP Link headers, or in the sitemap. Google says the three methods are equivalent and that using all three does not help.

x-default is the reserved value for “none of the codes matched”. The documentation recommends it as the fallback, especially on language-selector pages and on home pages that redirect by language. The page it points at can be one of the language versions. It does not need its own language code, because it is for people whose setting matched nothing. Adding hreflang="x-default" on top of the language links is an extra link element, not a replacement for them. A page with only x-default and no language codes has not named any language version.

Language codes are ISO 639-1, optionally followed by an ISO 3166-1 region, as in en-GB. A region alone is invalid. Google’s page gives the example that “be” is Belarusian, not Belgium, so hreflang="be" does not mean Belgium. Codes Google lists as having no effect include EU, UN and UK. x-default is not in that list. It is the documented fallback, not a region. Writing x-default in place of en, because the English page is “the default”, drops the English annotation. The English page should be hreflang="en" and, if you choose it as the fallback, also the target of x-default.

The annotations do not choose the canonical. Each language version should canonicalise to itself. A Spanish page whose canonical points at the English page is telling Google the Spanish URL is a duplicate of the English one, which fights the hreflang. x-default pointing at the English URL does not make the English URL the canonical of the Spanish page. They are different signals. Our pages keep a self-referencing canonical in every language and a separate alternate list.

Common failures, from the same documentation: a missing return link, a relative URL, a language code that is not a language, and a set that is different on each version. Google says that if a full mesh is hard to maintain you can omit some pairs, but new languages should still point both ways at the original language. An alternate that redirects or 404s is a URL you named and did not serve. Our checker warns when an alternate is relative, when x-default is missing from a page that has other alternates, and when a fetched alternate does not point back.

How to test: view the rendered head, not only the template. Collect every link rel="alternate" with an hreflang. Check that one of them is x-default if the page has language versions, that its href is absolute, and that the page it names lists this page back. Then open the sitemap and see the same set, if you publish alternates there. Do not expect the HTML lang attribute to do this job. Google says it does not use lang, or hreflang, to detect the language of the page.

If you want this done on your site, start with Technical SEO.

Tell us what you're launching.

Book a 20-minute intro call, or email a few lines about what you're launching. We'll reply with a rough plan and a price range, whether or not we end up working together.

We reply within one working day.