7

I have a website that has more than 1 language and I would to optimize my sitemap.xml so it will include all available languages - I found this guide on Google Webmaster Tools to use XHTML to provide all available URLs (one for each language) and this breaks the XML file, I've changed the properties to as described but it's still broken - not Chrome, Firefox or IE is able to read the file correctly.

Is this normal?

Here's an example of a sitemap.xml given by Google Webmaster Tools:

<?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>http://www.example.com/english/</loc>
    <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/deutsch/"/>
    <xhtml:link rel="alternate" hreflang="de-ch" href="http://www.example.com/schweiz-deutsch/"/>
    <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/english/"/>
  </url>
  <url>
    <loc>http://www.example.com/deutsch/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/english/"/>
    <xhtml:link rel="alternate" hreflang="de-ch" href="http://www.example.com/schweiz-deutsch/"/>
    <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/deutsch/"/>
  </url>
  <url>
    <loc>http://www.example.com/schweiz-deutsch/</loc>
     <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/deutsch/"/>
     <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/english/"/>
     <xhtml:link rel="alternate" hreflang="de-ch" href="http://www.example.com/schweiz-deutsch/"/>
  </url>
</urlset>
unor
  • 92,415
  • 26
  • 211
  • 360
nirpeled
  • 178
  • 1
  • 2
  • 8
  • I'm getting the same problem here, did you solved it ? – alex May 19 '14 at 19:11
  • Have the same problem also :( – Pavel Oct 26 '14 at 17:23
  • How to translate you site, page for every language? for example **index_fr.html** for page home frensh, **index_nd.html** for page home nederland or your change just the parameter ? –  Mar 11 '16 at 16:32
  • Does anyone have an example of any multi-lingual sitemap that passes any validator? – Alex Apr 19 '22 at 05:34

2 Answers2

1

such an old question but it popped up high on my results looking for something similar before.

So no, it's not normal but yes the sitemap.xml will still be valid. The xml schema doesn't include the xhtml:link namespace if I understand correctly.

It seems that Google recommends the incorrect thing and that others are implementing their advice such as the sitemap npm package

I've gotten it to work with this code:

<urlset
  xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
                      http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
                      http://www.w3.org/TR/xhtml11/xhtml11_schema.html
                      http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"
  xmlns:xhtml="http://www.w3.org/TR/xhtml11/xhtml11_schema.html"
  xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
  xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"
  xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
  xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">

even google themselves have an improper sitemap

flowen
  • 536
  • 4
  • 23
0

As long as Google Search Console does not complain about your sitemap.xml when it finds it (or when you submit it), there is no real SEO issue here.

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453