SchemaValid
ENDE
Technical SEO

Hreflang Sitemap Entries vs. HTML Tags: Which One to Use

Published: 8 min read
Contents

Google accepts hreflang annotations in three different places: an HTML <link> tag in every page's <head>, an HTTP header, or an entry in your XML sitemap. Most guides only show you the HTML version, which is fine until you have a hundred URLs times a dozen languages and your <head> section turns into a wall of link tags nobody wants to maintain by hand. The sitemap method solves that — but it has its own syntax to get right, and the same failure mode that breaks HTML hreflang breaks it too.

One signal, three delivery methods

Google's own documentation on localized versions lists the HTML tag, the HTTP header, and the sitemap entry as interchangeable — pick one method per site and stick to it, because mixing all three on the same set of pages adds maintenance risk without adding any signal strength. The header option is mostly useful for non-HTML files like PDFs, where there's no <head> to put a tag in.

For ordinary HTML pages, the real choice is between tags in the page itself and entries in the sitemap. Here's the practical difference. HTML tags live with the page: open the file, see every language alternate right there. Sitemap entries live in one central file: open the sitemap, see every language alternate for every URL, without touching a single page template.

For two languages and a few dozen URLs, that centralization barely matters. Past a few hundred URLs across many locales, editing hreflang in-page means shipping a template change every time you add a language; editing it in the sitemap means regenerating one XML file.

The XML sitemap syntax

Sitemap-based hreflang uses the XHTML namespace, which most sitemap generators don't add unless you specifically ask for hreflang support. Per Google's sitemap extension guide, the urlset root element needs the namespace declared, and then each url block gets one xhtml:link entry per language version — including one pointing at itself:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://example.com/en/pricing/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/pricing/" />
    <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise/" />
  </url>
  <url>
    <loc>https://example.com/de/preise/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/pricing/" />
    <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise/" />
  </url>
</urlset>

Miss the xmlns:xhtml declaration and the whole block fails as XML before Google ever gets to the hreflang logic — most validators will catch that first.

Not a ranking factor

Hreflang doesn't move your position in search results. Per Google's own documentation, it only tells Google which URL to serve a visitor based on their language and region — get it wrong and the wrong page shows up in the wrong market, but your rankings for the correct market stay exactly where your content earned them.

The reciprocal-tag rule

Both HTML and sitemap hreflang share one requirement that trips up almost every multi-language site at some point: annotations have to point both ways. If your English pricing page lists the German page as its de alternate, the German page has to list the English page back as its en alternate — and each page additionally lists itself. Google's guidance on localized versions is explicit that annotations without a matching return link may be ignored rather than corrected or guessed at.

/en/pricing//de/preise/hreflang="de"hreflang="en" (return tag)Both directions required — a one-way link is what breaks hreflangEach page also lists a self-referencing hreflang entry (not shown)

This is the failure mode that shows up after a redirect, a URL rename, or a page that got deleted on one side but not the other. Ahrefs' Site Audit tool has a dedicated check for exactly this, filed under the label "missing reciprocal hreflang (no return tag)."

Google used to surface hreflang problems through the International Targeting report in Search Console. That report is retired now, and there's no direct replacement inside Search Console itself. Catching a broken return tag today usually means running a crawler — Screaming Frog and Ahrefs both check reciprocity — or spot-checking a sample of URLs with the URL Inspection tool, rather than getting a dashboard warning.

HTML tags vs. sitemap entries: when each wins

HTML <link> tagsXML sitemap entries
Best fitA handful of locales, template-driven sitesDozens of locales, or URLs generated outside your page templates
Where you editEvery page templateOne central sitemap file
Visibility while debuggingView source on the actual pageOpen the sitemap and search
Non-HTML files (PDFs, etc.)Not applicable — no <head>Works, alongside the HTTP header option
Setup effort for 2 languagesLowUnnecessary overhead

Here's the opinion part: if you're running two languages and a normal template, sitemap-based hreflang is solving a problem you don't have. It earns its complexity on sites with real locale sprawl — a travel site with 15 country versions of every listing page is a legitimate sitemap-hreflang candidate. A blog with an English and a German version of each post isn't, and forcing it there just adds a second place for the reciprocal-tag rule to quietly break.

Sitemap limits and the x-default fallback

Whichever method you choose, the sitemap protocol itself still applies. As of July 2026, a single sitemap file is capped at 50,000 URLs and 50MB uncompressed per the sitemaps.org protocol — a site with more URLs than that needs a sitemap index pointing at multiple sitemap files, hreflang or not. Protocols do get revised, so treat that number as current rather than permanent and check the source directly before you build automation around it. Our XML Sitemap Generator flags it the moment a crawl passes that count, so you know to split the URLs across several sitemap files and list them in a sitemap_index.xml rather than shipping one oversized file.

x-default

hreflang="x-default" marks a fallback URL for visitors whose language or region doesn't match any of your listed alternates — typically your homepage or a language-selector page. Per Google's own guidance on x-default, it's optional, not required: skip it and unmatched visitors just get Google's normal best guess instead of your explicit fallback.

Build it without hand-coding the XML

Hand-writing xhtml:link blocks for a few dozen URLs is tedious and exactly the kind of task where a stray missing quote or unclosed tag breaks the whole file. Our free Hreflang Generator takes your language versions and outputs valid, reciprocal tags in whichever format matches your setup:

Your setupOutput format to generate
Editing page templates directlyHTML link tags
An existing XML sitemap you controlXML sitemap entries
Non-HTML files (PDFs, images)HTTP header

Everything runs in your browser; nothing you enter is sent anywhere. Once you've got sitemap entries, run the result through our Sitemap Validator to confirm the XML itself is well-formed before you push it live.

Hreflang GeneratorBuild valid, reciprocal hreflang tags in HTML, XML sitemap or HTTP header format — free, no account.Open the tool

Frequently asked questions

Does Google prefer HTML tags or sitemap entries for hreflang?
Neither. Google's documentation treats HTML link tags, HTTP headers, and XML sitemap entries as equivalent signals — the choice is about what's practical to maintain on your site, not about which one Google trusts more.
Do I need hreflang at all if I only have two language versions?
If both versions target different languages or regions and you want visitors routed to the right one, yes. What you don't need at that scale is the sitemap-based method — HTML tags in two page templates are simpler to maintain than a separate sitemap workflow.
What actually happens if I forget the return tag on one page?
Google's guidance says the annotation may be ignored rather than guessed at or corrected. In practice that usually means the affected page keeps showing up for the wrong locale, or doesn't get swapped in when it should.
Is hreflang a ranking factor?
No. It controls which URL variant is shown to a given visitor, not how well any of your pages rank. A page's rankings depend on the usual content and technical signals, independent of its hreflang setup.
Can I mix HTML tags and sitemap entries on the same site?
Technically the signals don't conflict, but Google's own guidance discourages combining all three methods because it adds a second or third place for the same reciprocal-tag rule to break without adding any extra signal strength. Pick one method per site.
What is x-default and do I need it?
It's a fallback hreflang value for visitors whose language or region doesn't match any of your listed alternates, usually pointing at your homepage or a language selector. It's optional — leaving it out just means those visitors get Google's default guess instead of your explicit fallback.
How many URLs can one sitemap file hold?
As of July 2026, the sitemaps.org protocol caps a single file at 50,000 URLs or 50MB uncompressed. Larger sites split into multiple sitemap files referenced from a sitemap index, regardless of whether hreflang is involved.
Will Google Search Console warn me if my hreflang setup is broken?
Not anymore for most sites — the dedicated International Targeting report was retired and there isn't a direct replacement inside Search Console. Spot-checking with the URL Inspection tool or running a crawler that checks reciprocity is currently the more reliable way to catch it.