2014-02-18 55 views
4

我正在开发一个网站。我的网站有一个sitemap.xml文件。该文件可以看到here使用自定义属性创建有效的站点地图

如果向下滚动,您将看到一个url条目,其中包含一些自定义标签。这些标签的前缀为blog:博客名称空间的定义可以看到here

我已将网站地图提交给Google网站管理员工具。但是,我收到有关与博客命名空间相关的条目的警告。这些警告出现如下所示:

Warnings 

Invalid XML tag 

This tag was not recognized. Please fix it and resubmit. 

Parent tag: url 
Tag: title 

Parent tag: url 
Tag: description 

Parent tag: url 
Tag: author 

我真的想包括我的sitemap文件的一些自定义元素。同时,我想确保我的sitemap.xml不会产生任何警告。我的问题是,这可能吗?如果是这样,我做错了什么?谢谢!

+0

http://stackoverflow.com/a/7175888/259881 –

回答

0

我使用的是自定义命名空间在我的网站地图的属性: http://pics.jonathancross.com/sitemap.xml

他们似乎很好地工作。

以下属性是jcd命名空间的一部分:

<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet type="text/xsl" href="sitemap.xsl"?> 
<urlset 
    xmlns:jcd="http://pics.jonathancross.com" 
    jcd:date="2015-09-16" 
    xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> 
    <url jcd:imgs="0" jcd:dsize="1.3G"> 
    <loc>http://pics.jonathancross.com/</loc> 
    <lastmod>2015-09-16</lastmod> 
    <priority>1.0</priority> 
    </url> 
    ... 

我还使用自定义desc元素是这样的:

<jcd:desc>Description of page here</jcd:desc> 

元素会导致谷歌网站管理员工具的错误,但是网站管理员工具仍然似乎解析它理解的站点地图数据。

动机:

将自定义数据添加到我的站点地图意味着它可以用作我的站点的中央数据库。我还使用xslt将相同的数据呈现为链接的结构化表格,供人类浏览该网站。

0

“博客”模式的目标名称空间不应与您在站点地图中分配的名称空间相同吗?

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
** xmlns:blog="http://www.ecofic.com" **  
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9  
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd  
http://www.ecofic.com/resources/root/blog/1.0 
http://www.ecofic.com/resources/root/blog.xml"> 
+0

这似乎也没有工作。谢谢你尝试。 –

0

定义名称空间属性如下?

<html xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 
xmlns:blog="http://www.google.com/2005/gml/b">