Tool

Multilingual sitemap.xml Generator

Build a valid multilingual sitemap with reciprocal hreflang links and x-default for a static HTML site, from a subfolder pattern or a CSV of localized slugs.

100% client-side: Your URLs and sitemap never leave your browser.

16 <url> entries • 4 locales • 8.4 KB

8.4 KB

Add this line to robots.txt:

Sitemap: https://example.com/sitemap.xml
Reference

HTML head versus sitemap.xml for hreflang

Search engines accept hreflang in the document head or in sitemap.xml. A link element can name every language version of a page, and xhtml:link can list that same cluster in each url entry. Both formats say which addresses match. Repeating the list in both places adds no weight, and two different lists leave a crawler unsure which one is current.

A shared template fits the head. A static export or a large catalog fits one sitemap file. Either channel works when the same set is kept on every page.

MethodProsConsWhen to use
HTML headThe list lives in the template and shows up in view source.Every page repeats it, and a missed template drifts.A small set already shares one alternate list.
sitemap.xmlOne file covers the site, slugs may differ by language, and HTML stays lighter.Each url block must repeat every alternate. A stale file never shows up in the page.Pages are static or the catalog is large.

Why every url entry repeats every xhtml:link

A crawler reads each url block alone. Links do not carry over from the next entry, so loc and every sibling must be xhtml:link elements in that same block. A German entry that lists only German is incomplete even when the English entry looks done. Each side needs the return link, or the cluster is only half declared.

English at the root and German under a de folder both repeat the same links. x-default, when used, points at the default URL for that page rather than an unrelated homepage.

<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/"/>
</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/"/>
</url>

FAQ

Why does sitemap.xml need the xmlns:xhtml namespace?

xhtml:link belongs to the xhtml namespace, not the sitemap namespace. Declare both on the urlset element. Without the xhtml declaration, crawlers do not treat those links as hreflang.

How should x-default be chosen?

Use the URL for visitors whose language is not listed. Keep it on the same page, such as the default pricing URL, rather than an unrelated homepage.

Why are priority and changefreq omitted?

Google ignores priority and changefreq. Leaving them out keeps the file shorter. lastmod is written only for a real calendar date, and an invalid date is left out.

How is the file submitted to Google Search Console and Bing Webmaster Tools?

Upload sitemap.xml and name it from robots.txt. Submit that address in Google Search Console and in Bing Webmaster Tools. After locales or slugs change, generate a new file and submit it again.

Does this generator upload URLs or the finished file?

No. The file is built in the browser. Paths, rows, and XML stay on the computer. Nothing is uploaded. Input stops at 5,000 rows, and a larger file shows a size warning.

Check return links in the hreflang and canonical validator. Compare structured data with the JSON-LD schema localization diff. Title and slug guidance sits in the HTML translation best practices guide. Other utilities are in the tools hub. Static pages start on the HTML Translate home page.