命名空间前缀xhtml在link上未定义 - sitemap.xml

19

我正在尝试向我的 sitemap.xml 文件添加语言,但出现了 "链接上的命名空间前缀 xhtml 未定义" 的错误。我该如何定义它?在谷歌上找不到有用的东西。

这是文件:

<?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"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
  <url>
    <loc>https://www.leepio.dk/</loc>


</urlset>

2
我对这些东西不是很熟悉,但是谷歌在这里的示例似乎使用了一组不同的命名空间:https://support.google.com/webmasters/answer/2620865?hl=en - Pekka
你成功定义了 xsischemaLocation 前缀... - Quentin
1个回答

33

这就可以做到。

更改

<urlset
    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/1999/xhtml http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"
    xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"   
>

说明

按照给定的方式定义xmlns:xhtml。将xmlns:xhtml映射到存储模式的位置,即http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd


它确实起作用了,谢谢。看起来WooRank.com在检测网站数据方面也存在一些问题。 - crystyxn
1
https://dev59.com/7pXfa4cB1Zd3GeqPeGFe - Vladimir Vukanac

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接