hreflang Without the Headaches: A Field Guide
The five mistakes that quietly split your ranking signals across locales, and how to fix them.
6 min readFrom a manual WordPress snippet to plugins that handle it automatically, here's how to configure x-default so unmatched visitors always land on the right page.
If you have a website that serves multiple languages or regions, hreflang and x-default are two of the technical details worth getting right as part of your broader international SEO strategy. Together, they help search engines serve the right version of your page for each visitor. But if they’re implemented incorrectly, search engines might not show the preferred version at all.
Hreflang helps search engines direct users to the most relevant version of your page based on their language or region. If you want to target English for the US and Spanish for Mexico, your website URLs will probably look like this:
Additionally, your page’s hreflang block should look like this with the same pair of tags appearing on both pages and pointing users toward their designated pages:
X-default, meanwhile, stops users who don’t match a specific language or region from getting lost.
Hreflang helps search engines match users to the most relevant language or region version of a page. However, if someone visits from a country or language you haven’t specifically targeted, x-default can point search engines to your chosen universal page, ensuring that you don’t lose any potential visitors.
Why is x-default important?
Every URL in an hreflang cluster should carry the full annotation set, including x-default, so that crawlers landing on your pages will see every language alternate and know where unmatched visitors should go.
In the example below, you’ll see the /en/ page’s <head> includes this same set as the /es/ page’s.
Hreflang codes use ISO 639-1 for the language (en, es) and, optionally, ISO 3166-1 Alpha 2 for the region (en-US, es-MX). If you get the codes wrong or mix up the language and region order, then the hreflang tag won’t direct users to the right page.
Hreflang is not the same as the HTML lang attribute. Lang denotes only the language for the page it sits on. Hreflang describes the relationship between multiple URLs, and informs search engines about the other language and regional versions of the page.
Reciprocal tags
One thing you need to make sure you get right for hreflang is reciprocal tags.
If your /en/ page declares /es/ as its Spanish alternate, your /es/ page needs to declare /en/ back. If the reference isn’t mutual, search engines might discard the pair altogether.
If someone edits, adds, or regenerates one page in the cluster without updating the return tags on the other, the whole cluster’s signal could break.
When possible, point x-default to the language selector page or a generic landing page that auto-detects locale, since these are the most likely pages an unmatched visitor should land on.
If, however, you have one primary market (such as US English) and the other locales are secondary, point x-default at your primary-language URL because it’s the version most sites already treat as canonical.
What if you don’t have a selector page or your homepage redirects based on geo-IP?
If you don’t have a selector page, choose a stable URL that already participates in the hreflang cluster.
If your homepage redirects based on geo-IP, don’t point x-default there. If that homepage 301s to a locale-specific URL depending on where the request comes from, search engines won’t have a stable URL to fallback on. Ideally, you’ll want to point the x-default at the URL that will return the same response for everyone.
What if you’re not running a translation plugin?
You can add the tag directly in WordPress with a small snippet:
However, before dropping this snippet into your theme’s functions.php, make sure it sits as part of the full hreflang block, and that the rest of the cluster’s alternates are on the page too.
If you’re already running something like Polylang or WPML, most handle the full hreflang cluster, including x-default. However, you will still need to confirm which language you’ve set as the default, since that will determine where x-default points.
Bablic generates hreflang tags, including x-default, automatically for every published language version of a page with reciprocal references, in both the page head and the auto-generated sitemap.
With Bablic, you don’t need to manually keep return tags in sync as you add or edit language versions.
A typical generated set looks like this, for a site publishing English, Russian, and Spanish:
This is important because some tools translate what a visitor sees in the browser without changing the URL, swapping the language client-side. The problem is there’s no separate URL for hreflang to describe, so your translated content is invisible to search bots. It’s a similar blind spot to relying on browser-level machine translation and assuming it’s reliable enough to stand in for a real localized page. It might look fine to a human visitor, but a crawler won’t see it as distinct content.
Bablic creates an actual, crawlable URL for each language you publish. That’s the precondition for hreflang, and x-default, to do anything at all. You install it with a JavaScript snippet, and the hreflang cluster builds itself as you publish new language versions. There’s no manual tag management required.
Paste one line of JavaScript and watch your own site translate in minutes. No credit card required.