Skip to content
Back to Blog
TechnicalSEOAI Agents

Hreflang Tags and How Agents Route International Traffic

Agent Checker3 min read

If your site serves content in multiple languages or for different regions, hreflang annotations tell agents which version to show to which audience. An agent acting on behalf of a user in Germany should get the German page, not the English one. But hreflang implementation is notoriously error-prone, and mistakes leave agents with no clear signal about which version to choose.

How hreflang works

Hreflang tags create a map of language and region variants for each page. They can appear as <link> elements in the <head>, as HTTP headers, or in your sitemap.

<link rel="alternate" hreflang="en-gb" href="https://example.com/shoes" />
<link rel="alternate" hreflang="en-us" href="https://example.com/us/shoes" />
<link rel="alternate" hreflang="de" href="https://example.de/schuhe" />
<link rel="alternate" hreflang="fr" href="https://example.fr/chaussures" />
<link rel="alternate" hreflang="x-default" href="https://example.com/shoes" />

The hreflang attribute uses ISO 639-1 language codes (optionally combined with ISO 3166-1 region codes). The x-default value specifies the fallback page for users or agents that do not match any listed language or region.

How agents use hreflang

Agents working on behalf of users care about locale. If a user in France asks an agent to find a specific product, the agent should return the French-language page with EUR pricing, not the English page with GBP pricing.

Agents use hreflang tags to:

  • Select the correct language variant without having to guess from the URL structure
  • Avoid returning translated duplicates in multi-language search results
  • Surface region-specific information like local pricing, availability, or shipping options

Without hreflang, an agent might return the English version to a French-speaking user, or worse, treat each language version as a separate product and present duplicates. This is closely related to how multi-language content affects agent locale detection.

Common implementation errors

Hreflang has one of the highest error rates of any HTML annotation. These are the mistakes agents encounter most often:

Missing x-default

The x-default tag specifies where to send traffic that does not match any listed language or region. Without it, agents have no fallback. If a user's locale is pt-BR and you only have en-gb and de variants, the agent does not know which one to choose.

Non-reciprocal links

Hreflang tags must be reciprocal. If the English page points to the German page, the German page must point back to the English page. When this relationship is one-directional, agents may ignore the hreflang data entirely because it is inconsistent.

English page → links to German page ✓
German page → links to English page ✓  (reciprocal, correct)

English page → links to French page ✓
French page → no link to English page ✗  (broken, agents distrust this)

Wrong language codes

Using en when you mean en-gb, or zh when you mean zh-hant, leads to incorrect routing. An agent looking for traditional Chinese content might match a simplified Chinese page because the hreflang code was too broad.

Pointing to non-canonical URLs

Each hreflang tag should point to the canonical URL for that language variant. If your canonical is https://example.de/schuhe but the hreflang tag points to https://www.example.de/schuhe, agents face a conflict between two signals.

Using country codes alone

hreflang="gb" is invalid. The attribute requires a language code, not a country code. The correct value for British English is en-gb. This mistake is surprisingly common and renders the tag useless.

Implementation approaches

For small sites (under 50 pages per language), inline <link> tags in the <head> are simplest. For larger sites, sitemap-based hreflang avoids bloating your HTML:

<url>
  <loc>https://example.com/shoes</loc>
  <xhtml:link rel="alternate" hreflang="en-gb" href="https://example.com/shoes" />
  <xhtml:link rel="alternate" hreflang="de" href="https://example.de/schuhe" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/shoes" />
</url>

This keeps your page markup clean while giving agents the same routing information.

Validating hreflang

Check every page for reciprocal links, valid language codes, and matching canonical URLs. Automated crawl tools can flag non-reciprocal hreflang pairs across your site. Given the high error rate, this is worth running regularly, especially after adding new language variants or restructuring URLs.