1

I've been writing XML Sitemaps for a decade, but I've never before needed to write an XML Sitemap for an international site.

It occurs to me that there are three clear approaches (and there may be additional, even better approaches).

Approach 1 : Single XML Sitemap (primary language URLs only, with corresponding pages)

<url>
  <loc>https://example.com/example-page-1/</loc>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-1/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-1/" />
</url>

<url>
  <loc>https://example.com/example-page-2/</loc>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-2/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-2/" />
</url>

Approach 2 : Single XML Sitemap (all relevant URLs, with corresponding pages)

<url>
  <loc>https://example.com/example-page-1/</loc>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-1/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-1/" />
</url>

<url>
  <loc>https://example.com/example-page-2/</loc>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-2/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-2/" />
</url>

<url>
  <loc>https://example.com/de/beispielseite-1/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/example-page-1/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-1/" />
</url>

<url>
  <loc>https://example.com/de/beispielseite-2/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/example-page-2/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-2/" />
</url>

Approach 3: Multiple XML Sitemaps (relevant URLs listed for each language, with corresponding pages)

sitemap-en.xml:

<url>
  <loc>https://example.com/example-page-1/</loc>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-1/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-1/" />
</url>

<url>
  <loc>https://example.com/example-page-2/</loc>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-2/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-2/" />
</url>

sitemap-de.xml:

<url>
  <loc>https://example.com/de/beispielseite-1/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/example-page-1/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-1/" />
</url>

<url>
  <loc>https://example.com/de/beispielseite-2/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/example-page-2/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-2/" />
</url>

Much of the advice available on the web is from the first half of the 2010s.

In 2020, is there an established approach to describe an international site using XML sitemaps?

  • At present, I see the merits of Approach 3, but - for ease of maintenance - I favour Approach 2. At the very least I need to make sure that Approach 2 is legitimate and that it's not the case that Approach 1 is actually the standard single sitemap approach. – Rounin Mar 18 at 11:07
1

The answers are all here:

Two of the most important key points to note are:

Each language version must list itself as well as all other language versions.

and

If two pages don't both point to each other, the tags will be ignored. This is so that someone on another site can't arbitrarily create a tag naming itself as an alternative version of one of your pages.

This suggests:

  • Approach 1 is definitely wrong
  • Approach 2 in the question is almost right, but needs extending to satisfy all requirements
  • Approach 3 would also be legitimate, if it were similarly extended to satisfy all requirements

Google gives the following example:

<url>
    <loc>http://www.example.com/english/page.html</loc>
    <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="de-ch" href="http://www.example.com/schweiz-deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/english/page.html"/>
</url>

<url>
  <loc>http://www.example.com/deutsch/page.html</loc>
  <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/deutsch/page.html"/>
  <xhtml:link rel="alternate" hreflang="de-ch" href="http://www.example.com/schweiz-deutsch/page.html"/>
  <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/english/page.html"/>
</url>

<url>
  <loc>http://www.example.com/schweiz-deutsch/page.html</loc>
  <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/deutsch/page.html"/>
  <xhtml:link rel="alternate" hreflang="de-ch" href="http://www.example.com/schweiz-deutsch/page.html"/>
  <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/english/page.html"/>
</url>

This means an extended version of Approach 2 will satisfy all requirements:

<url>
  <loc>https://example.com/example-page-1/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/example-page-1/" />
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-1/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-1/" />
</url>

<url>
  <loc>https://example.com/example-page-2/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/example-page-2/" />
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-2/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-2/" />
</url>

<url>
  <loc>https://example.com/de/beispielseite-1/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/example-page-1/" />
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-1/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-1/" />
</url>

<url>
  <loc>https://example.com/de/beispielseite-2/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/example-page-2/" />
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/beispielseite-2/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/example-page-2/" />
</url>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.