Multilingual sitemap.xml file
Asked Answered
J

2

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>
Jayson answered 2/12, 2013 at 14:36 Comment(4)
I'm getting the same problem here, did you solved it ?Praseodymium
Have the same problem also :(Reconnaissance
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 ?Elide
Does anyone have an example of any multi-lingual sitemap that passes any validator?Centralia
C
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

Compander answered 24/6, 2021 at 6:44 Comment(0)
T
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.

Tobietobin answered 26/1, 2018 at 16:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.