1

In my Google console, I am getting 1 error and can not understand the given error. All sitemap validators say it is correct but Google does not accept this sitemap.

I edit it for this error and delete this all:

          writer.WriteAttributeString("xmlns:xhtml", "http://www.w3.org/1999/xhtml");
        //writer.WriteAttributeString("xmlns:xsi", "https://www.w3.org/2001/XMLSchema-instance");
        //writer.WriteAttributeString("xsi:schemaLocation", "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd");

But it does not change anything, the error continues. Here is my sitemap content:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://xx.com.tr/tr</loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
<link rel="alternate" hreflang="tr" href="http://xx.com.tr/tr"/>
<link rel="alternate" hreflang="de" href="http://xx.com.tr/de"/>
<link rel="alternate" hreflang="en" href="http://xx.com.tr/en"/>
<link rel="alternate" hreflang="x-default" href="http://xx.com.tr/"/>
</url>
<url>
<loc>http://xx.com.tr/de</loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
<link rel="alternate" hreflang="tr" href="http://xx.com.tr/tr"/>
<link rel="alternate" hreflang="de" href="http://xx.com.tr/de"/>
<link rel="alternate" hreflang="en" href="http://xx.com.tr/en"/>
<link rel="alternate" hreflang="x-default" href="http://xx.com.tr/"/>
</url>
<url>
<loc>http://xx.com.tr/en</loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
<link rel="alternate" hreflang="tr" href="http://xx.com.tr/tr"/>
<link rel="alternate" hreflang="de" href="http://xx.com.tr/de"/>
<link rel="alternate" hreflang="en" href="http://xxxx.com.tr/en"/>
<link rel="alternate" hreflang="x-default" href="http://xx.com.tr/"/>
</url>
<url>
<loc>http://xx.com.tr/</loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
<link rel="alternate" hreflang="tr" href="http://xx.com.tr/tr"/>
<link rel="alternate" hreflang="de" href="http://xx.com.tr/de"/>
<link rel="alternate" hreflang="en" href="http://xx.com.tr/en"/>
<link rel="alternate" hreflang="x-default" href="http://xx.com.tr/"/>
</url>
</urlset>

Error is:

Expected: http://www.w3.org/1999/xhtml
Situated: http://www.sitemaps.org/schemas/sitemap/0.9
Main tag: url
tag: link
2

<link> is not part of the Sitemap "protocol", see https://www.sitemaps.org/protocol.html

So you need to remove all of them, which gives you this file that should be accepted by Google:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://xx.com.tr/tr</loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>http://xx.com.tr/de</loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>http://xx.com.tr/en</loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>http://xx.com.tr/</loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
</url>
</urlset>

PS: in future cases, please use RFC2606 if you really need to obfuscate names which means basically to use example.com, example.net and .example as domain names and TLDs.

4
  • Thanks to you I found it support.google.com/webmasters/answer/189077?hl=en there is "Methods for indicating your alternate pages tabs" I was doing it false.And thank you for advice . – Alican Kablan Jul 25 '18 at 20:56
  • @AlicanKablan The page you quote is indeed how you can use <link> in your HTML content, but you just can not use it in your sitemaps. The crawler will get your content from the sitemaps and will then find in the content the <link> nodes and act on it as necessary. – Patrick Mevzek Jul 25 '18 at 21:04
  • This is how you support hreflang and link in sitemaps: support.google.com/webmasters/answer/189077?hl=en – Tony McCreath Jul 28 '18 at 1:32
  • @TonyMcCreath I do exactly that and am told Your Sitemap or Sitemap index file doesn't properly declare the namespace. by Google – mplungjan Nov 26 '19 at 13:22

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.