创建具有自定义属性的有效站点地图 [英] Creating a valid sitemap with custom attributes

查看:34
本文介绍了创建具有自定义属性的有效站点地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个网站.我的网站有一个 sitemap.xml 文件.可以在此处查看该文件.

I'm working on a website. My website has a sitemap.xml file. That file can be seen here.

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

If you scroll down, you will see a url entry that includes some custom tags. Those tags are prefixed with blog: The definition for the blog namespace can be seen here.

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

I've submitted my sitemap to the Google Webmaster Tools. However, I receive warnings around the entries associated with the blog namespace. Those warnings appear as shown here:

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.xml 不会产生任何警告.我的问题是,这可能吗?如果是这样,我做错了什么?谢谢!

I would really like to include some custom elements in my sitemap file. At the same time, I want to ensure that my sitemap.xml does not generate any warnings. My question is, is this possible? If so, what am I doing wrong? Thank you!

推荐答案

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

I am using a custom namespace for attributes in my sitemap: http://pics.jonathancross.com/sitemap.xml

它们似乎工作正常.

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

The following attributes are part of the jcd namespace:

<?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 元素,如下所示:

I also use a custom desc element like this:

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

该元素会导致 Google 网站站长工具出错,但网站站长工具似乎仍在解析它理解的站点地图数据.

The element causes errors in Google Webmaster Tools, however Webmaster Tools still seems to parse the sitemap data it understands.

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

Adding custom data to my sitemap means it can be used as a central database for my site. I also use xslt to render the same data into a structured table of links for humans to browse the site.

这篇关于创建具有自定义属性的有效站点地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆