문제

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

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.

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 

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!

도움이 되었습니까?

해결책

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

They seem to work fine.

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>
  ...

I also use a custom desc element like this:

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

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

Motivation:

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.

다른 팁

Shouldn't the target namespace of the "blog" schema be the same as the one you assign in it in your sitemap?

<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">

Defining the namespace attribute as follows?

<html xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:blog="http://www.google.com/2005/gml/b">
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top