Validation of XML Sitemap urlset with xhtml:link inside url element

寵の児 提交于 2019-12-03 16:33:52

There are two issues in this document:

  1. The schemaLocation attribute must be in the XML Schema Instance namespace.

  2. The url element is invalid, because its definition says processContents="strict" and the schema for XHTML was missing so that there was no xhtml:link declaration in scope.

    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xhtml="http://www.w3.org/1999/xhtml"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
        http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
        http://www.w3.org/1999/xhtml
        http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd">
      <url>
        <loc>http://www.something.com/something</loc>
        <xhtml:link rel="alternate" hreflang="en-us" href="http://www.something.com/something" />
      </url>
    </urlset>
    

You should place your site maps inside of your robots.txt file. Google tends to do things fairly strict so listening to them will help you better understand the structure they expect.

My website's robots.txt file as a live example (link in profile).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!