对于XML Sitemaps,文档是否可以包含多个Protocol Extensions?(For XML Sitemaps, can a document contain multiple Protocol Extensions?)

在提出这个问题之前,我做了大量的研究。 我甚至去谷歌搜索"sitemap" filetype:xml - 查看一些大联盟的站点地图文件,看看这里是否有答案。

实际问题:

XML站点地图支持“扩展”: https : //www.sitemaps.org/protocol.html#extending Google支持新闻,图片,视频和通用: https : //support.google.com/webmasters/topic/6080646?hl = zh-CN &ref_topic = 4581190 它还支持多语言内容: https : //support.google.com/webmasters/answer/2620865?hl = zh-CN &ref_topic = 6080646 它还支持“站点地图索引”: https : //support.google.com/webmasters/answer/75712? visit_id = 1-636476631020171976-2911222833 &rd = 1

XML Sitemap可以一次使用多个扩展吗?

我无法找到任何人在野外做这样的例子。 这意味着要么它不会工作,要么没有这样做是有很好的理由的。 但是我找不到关于此的支持信息。


站点地图索引是他们自己的文档是有道理的,因为XSD文件必须是不同的: https : //www.sitemaps.org/schemas/sitemap/0.9/

但是看这里: https : //www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd - 我没有找到任何线索......然后是Nike的XML文档: https : //store.nike.com/网站地图商店烯ca.xml

它有:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">

但是网站地图的内容仍然正常化,没有混合节点。

转到https://www.google.com/schemas/sitemap-image/1.1/我看到:

Google使用XML模式来定义可能会出现在您的Sitemap文件中的元素和属性。 站点地图可能包含核心站点地图元素和特定于图片的元素。

我真的很想知道,我可以,让我们说一个博客 - 然后是一个XML Sitemap,其中包含文章的URL,URL,翻译XHTML节点,我想为该URL索引的图像,视频在这个URL和这样的所有在一个...

您可以访问http://www.cnn.com/sitemaps/sitemap-gallery-2017-11.xml并在urlsets中添加与图像内容并行的视频内容吗?

I did a lot of research before asking this question. I even went to Google and searched for "sitemap" filetype:xml -- to look at some big-league sitemap files to see if there was an answer here.

Actual Question:

XML sitemaps support "extensions": https://www.sitemaps.org/protocol.html#extending Google supports News, Images, Video and Generic: https://support.google.com/webmasters/topic/6080646?hl=en&ref_topic=4581190 It also supports multi-lingual content: https://support.google.com/webmasters/answer/2620865?hl=en&ref_topic=6080646 It also supports, "sitemap indexes": https://support.google.com/webmasters/answer/75712?visit_id=1-636476631020171976-2911222833&rd=1

Can an XML Sitemap make use of multiple extensions at once?

I cannot find an example of anyone doing this in the wild. Which means that either it will not work or there's a really good reason for not doing this. But there's no supporting information that I can find about this.


Sitemap Indexes being their own document makes sense because the XSD file has to be different: https://www.sitemaps.org/schemas/sitemap/0.9/

But looking here: https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd -- I didn't find any clues... then Nike's XML document: https://store.nike.com/sitemap-store-en-ca.xml

It has:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">

But the content of the sitemap is still normalized, there's not a mixture of nodes.

Going to https://www.google.com/schemas/sitemap-image/1.1/ I see:

Google uses XML schemas to define the elements and attributes that can appear in your Sitemap file. A Sitemap may contain both core Sitemap elements and elements specific to Images.

I'd really love to know, could I have, let's say a blog -- then an XML Sitemap that houses the URLs to the articles, the URLs, the translation XHTML nodes, the images I'd like indexed for that URL, videos on that URL and such all in one...

Could you go to http://www.cnn.com/sitemaps/sitemap-gallery-2017-11.xml and within the urlsets, add video content in parallel with the image content?

最满意答案

这至少得到Google的支持。 如果您在此处查看XML网站地图格式,请访问: https : //support.google.com/webmasters/answer/183668?hl = zh_CN

你会发现这个例子混合了图像和视频节点。

<?xml version="1.0" encoding="UTF-8"?> &t;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"> <url> <loc>http://www.example.com/foo.html</loc> <image:image> <image:loc>http://example.com/image.jpg</image:loc> <image:caption>Dogs playing poker</image:caption> </image:image> <video:video> <video:content_loc> http://www.example.com/video123.flv </video:content_loc> <video:player_loc allow_embed="yes" autoplay="ap=1"> http://www.example.com/videoplayer.swf?video=123 </video:player_loc> <video:thumbnail_loc> http://www.example.com/thumbs/123.jpg </video:thumbnail_loc> <video:title>Grilling steaks for summer</video:title> <video:description> Cook the perfect steak every time. </video:description> </video:video> </url> </urlset>

我在这里查看了图像命名空间的XSD: http : //www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd

这些节点的模式定义对兄弟节点没有任何要求,您应该能够在urlset中删除这些混合的站点地图节点类型。

This is supported by at least Google. If you look under the XML sitemap format here: https://support.google.com/webmasters/answer/183668?hl=en

You'll find this example where they mix image and video nodes.

<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"> <url> <loc>http://www.example.com/foo.html</loc> <image:image> <image:loc>http://example.com/image.jpg</image:loc> <image:caption>Dogs playing poker</image:caption> </image:image> <video:video> <video:content_loc> http://www.example.com/video123.flv </video:content_loc> <video:player_loc allow_embed="yes" autoplay="ap=1"> http://www.example.com/videoplayer.swf?video=123 </video:player_loc> <video:thumbnail_loc> http://www.example.com/thumbs/123.jpg </video:thumbnail_loc> <video:title>Grilling steaks for summer</video:title> <video:description> Cook the perfect steak every time. </video:description> </video:video> </url> </urlset>

I took a look at the XSD for the image namespace here: http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd

The schema definition for these nodes does not have any requirements about sibling nodes and you should be able to drop these mixed sitemap node types within a urlset.

更多推荐