← All tools

Hreflang sitemap

Turn a page × locale table into a sitemap with xhtml:link alternates.
One row per page: locale codes as headers, then the URL of each version
Comma or tab separated. Empty cells are fine — that locale is skipped for that page.
Options
All checks pass
  • Note: 8 <url> entries for 3 pages in 3 locales. Each version lists every alternate, including itself.
  • Pass: Ready to upload. Reference it from robots.txt or Search Console.
sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/" />
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
</url>
<url>
<loc>https://example.com/de/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/" />
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
</url>
<url>
<loc>https://example.com/fr/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/" />
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
</url>
<url>
<loc>https://example.com/pricing</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/pricing" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs" />
</url>
<url>
<loc>https://example.com/de/preise</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/pricing" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs" />
</url>
<url>
<loc>https://example.com/fr/tarifs</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/pricing" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise" />
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs" />
</url>
<url>
<loc>https://example.com/blog</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/blog" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/blog" />
</url>
<url>
<loc>https://example.com/de/blog</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/blog" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/blog" />
</url>
</urlset>
● All goodHreflang sitemapLocal-only

What it’s good for

Hreflang for thousands of pages, in one file.

  • Large sitesEasier than adding tags to every template.
  • From a spreadsheetPaste columns straight from your URL mapping sheet.
  • Always reciprocalEvery URL lists every alternate, so return links are guaranteed.

Questions

The short answers.

Sitemap or head tags?

Either works. Use one method, not both, to avoid conflicts.

What if a page has no translation?

Leave the cell empty. That locale is skipped for that page only.

Size limits?

50,000 URLs or 50 MB per sitemap. Split larger sets with a sitemap index. The tool warns you when the output passes either limit.

What date does lastmod use?

Today's date, for every entry. Only keep it on if the pages really changed today; otherwise turn it off rather than publishing dates that aren't true.

Can cells contain commas?

Yes, if the cell is wrapped in double quotes, as spreadsheets do when exporting CSV. Tab-separated paste works too.

See all →