Hreflang XML Sitemap: 3 Examples You Can Steal - Martin Kura

10/07/2021by Martin Kura0
hreflang-sitemap.jpg

In order to tell Google and other search engines which language/country version is intended for which audience, you can use a Hreflang sitemap.

A Hreflang sitemap indicate how the language/country versions are related. Each URL that has an equivalent in another language/country should be specified in a separate row of the sitemap. You need to add the URL itself with all its equivalents.

Below are some examples of how a Hreflang sitemap could look like for subdirectories, ccTLDs and subdomains.

Subdirectories

Versions:

  • example.com (English)
  • example.com/de (German)
  • example.com/fr (French)

<?xml version=”1.0″ encoding=”UTF-8″?><urlset xmlns=”https://www.sitemaps.org/schemas/sitemap/0.9″ xmlns:xhtml=”https://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></urlset>

Subdomains

Versions:

  • example.com (English)
  • de.example.com (German)
  • fr.example.com (French)

<?xml version=”1.0″ encoding=”UTF-8″?><urlset xmlns=”https://www.sitemaps.org/schemas/sitemap/0.9″ xmlns:xhtml=”https://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://de.example.com”/><xhtml:link rel=”alternate” hreflang=”fr” href=”https://fr.example.com”/></url><url><loc>https://de.example.com</loc><xhtml:link rel=”alternate” hreflang=”en” href=”https://example.com”/><xhtml:link rel=”alternate” hreflang=”de” href=”https://de.example.com”/><xhtml:link rel=”alternate” hreflang=”fr” href=”https://fr.example.com”/></url><url><loc>https://fr.example.com</loc><xhtml:link rel=”alternate” hreflang=”en” href=”https://example.com”/><xhtml:link rel=”alternate” hreflang=”de” href=”https://de.example.com”/><xhtml:link rel=”alternate” hreflang=”fr” href=”https://fr.example.com”/></url></urlset>

ccTLDs

Versions:

  • example.com (English)
  • example.de (German)
  • example.fr (French)

<?xml version=”1.0″ encoding=”UTF-8″?><urlset xmlns=”https://www.sitemaps.org/schemas/sitemap/0.9″ xmlns:xhtml=”https://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.de”/><xhtml:link rel=”alternate” hreflang=”fr” href=”https://example.fr”/></url><url><loc>https://example.de</loc><xhtml:link rel=”alternate” hreflang=”en” href=”https://example.com”/><xhtml:link rel=”alternate” hreflang=”de” href=”https://example.de”/><xhtml:link rel=”alternate” hreflang=”fr” href=”https://example.fr”/></url><url><loc>https://example.fr</loc><xhtml:link rel=”alternate” hreflang=”en” href=”https://example.com”/><xhtml:link rel=”alternate” hreflang=”de” href=”https://example.de”/><xhtml:link rel=”alternate” hreflang=”fr” href=”https://example.fr”/></url></urlset>

Hreflang Sitemap Generators

You can also use dedicated XML sitemap generators to create a Hreflang sitemap.

Martin Kura

A multi-cultural nerd, digital marketer and SEO/content enthusiast. Likes good beer, dry wine, loves to cook and sing (sometimes all at once).