Baron Munchausen’s Crawl Test Lab

Hreflang Example: Common Hreflang Errors

I herded the Sultan's bees in what I swore was perfect Turkish, and the bees replied with a sharp correction about my region code.

The short answer

What it is
Hreflang issues include an invalid code, a missing href, a target that is broken, redirects, or is noindex, a missing return link, or a mismatch between the page and the sitemap.
Why it matters
Search engines may ignore bad annotations and show the wrong language or country version. Visitors then land on a page they cannot read or a store that will not ship to them.
How a crawler should report it
Report the source URL, the hreflang value, the target, and the exact fault, such as invalid code, no return link, or noindex target. Show the target status alongside each row.
Live examples
The Baron riding through the air astride a cannonball, high above a battlefield.
Fig. 29. Outbound tag, inbound cannonball: a proper return link.

Language Codes and Return Links That Search Engines Reject

An hreflang example looks like this: <link rel="alternate" hreflang="en-GB" href="https://example.com/uk/">. The value starts with an ISO 639-1 language code. It may add an ISO 3166-1 alpha-2 region code. A very common error is en-UK, since the correct country code for the United Kingdom is GB. Other errors come from swapped order, typing mistakes, and using a country code where a language is needed.

Annotations work as a set. If page A names page B as an alternate, then page B must name page A in return. Google says it may ignore the pair when that link is missing. Each page should also list itself. The x-default value names a fallback for users who match none of your versions. You can declare all of this in HTML, in HTTP headers, or in an XML sitemap, but choose one method and keep it consistent.

To detect problems, collect the annotations from each page and sitemap. Validate every code against the ISO lists. Then fetch each target and record its status, its redirects, and its robots directives. Build a map of pairs to find missing return links. Compare the HTML data with the sitemap data to find places where they disagree. Targets should return 200, be indexable, and be the canonical version of their page.

To fix hreflang, generate the tags from one list of page versions and do not write them by hand. That way, each new page adds its return links for free. Correct all invalid codes. Point each annotation at the final URL, not one that redirects. Remove targets that are noindex or gone. Do not auto-redirect visitors based on their location alone, because crawlers may then fail to reach every language version of your site.