对于 XML 个站点地图,一个文档可以包含多个协议扩展吗?
For XML Sitemaps, can a document contain multiple Protocol Extensions?
在问这个问题之前我做了很多研究。我什至去了 Google 并搜索了 "sitemap" filetype:xml
-- 查看一些大联盟站点地图文件,看看这里是否有答案。
实际问题:
- XML 站点地图支持 "extensions": https://www.sitemaps.org/protocol.html#extending
- Google 支持新闻、图片、视频和通用:https://support.google.com/webmasters/topic/6080646?hl=en&ref_topic=4581190
- 它还支持多语言内容:https://support.google.com/webmasters/answer/2620865?hl=en&ref_topic=6080646
- 也支持,"sitemap indexes":https://support.google.com/webmasters/answer/75712?visit_id=1-636476631020171976-2911222833&rd=1
一个 XML 站点地图可以同时使用多个扩展吗?
我找不到任何人在野外这样做的例子。这意味着它要么不起作用,要么有充分的理由不这样做。但是我找不到关于此的支持信息。
站点地图索引是它们自己的文档是有道理的,因为 XSD 文件必须不同:https://www.sitemaps.org/schemas/sitemap/0.9/
但是看这里: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
它有:
<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">
但是sitemap的内容还是规范化的,没有混杂节点。
要去https://www.google.com/schemas/sitemap-image/1.1/ 我明白了:
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.
我真的很想知道,我能不能有一个博客——然后是一个 XML 站点地图,其中包含文章的 URL,URL s,翻译的 XHTML 节点,我想为那个 URL 建立索引的图像,那个 URL 上的视频,等等……
你能转到 http://www.cnn.com/sitemaps/sitemap-gallery-2017-11.xml 并在 urlsets 中,在添加图像内容的同时添加视频内容吗?
至少 Google 支持这一点。如果您在此处查看 XML 站点地图格式:https://support.google.com/webmasters/answer/183668?hl=en
您会在这个示例中找到他们混合图像和视频节点的地方。
<?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>
我在这里查看了图像命名空间的 XSD:http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd
这些节点的架构定义对同级节点没有任何要求,您应该能够将这些混合站点地图节点类型放入 urlset 中。
在问这个问题之前我做了很多研究。我什至去了 Google 并搜索了 "sitemap" filetype:xml
-- 查看一些大联盟站点地图文件,看看这里是否有答案。
实际问题:
- XML 站点地图支持 "extensions": https://www.sitemaps.org/protocol.html#extending
- Google 支持新闻、图片、视频和通用:https://support.google.com/webmasters/topic/6080646?hl=en&ref_topic=4581190
- 它还支持多语言内容:https://support.google.com/webmasters/answer/2620865?hl=en&ref_topic=6080646
- 也支持,"sitemap indexes":https://support.google.com/webmasters/answer/75712?visit_id=1-636476631020171976-2911222833&rd=1
一个 XML 站点地图可以同时使用多个扩展吗?
我找不到任何人在野外这样做的例子。这意味着它要么不起作用,要么有充分的理由不这样做。但是我找不到关于此的支持信息。
站点地图索引是它们自己的文档是有道理的,因为 XSD 文件必须不同:https://www.sitemaps.org/schemas/sitemap/0.9/
但是看这里: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
它有:
<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">
但是sitemap的内容还是规范化的,没有混杂节点。
要去https://www.google.com/schemas/sitemap-image/1.1/ 我明白了:
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.
我真的很想知道,我能不能有一个博客——然后是一个 XML 站点地图,其中包含文章的 URL,URL s,翻译的 XHTML 节点,我想为那个 URL 建立索引的图像,那个 URL 上的视频,等等……
你能转到 http://www.cnn.com/sitemaps/sitemap-gallery-2017-11.xml 并在 urlsets 中,在添加图像内容的同时添加视频内容吗?
至少 Google 支持这一点。如果您在此处查看 XML 站点地图格式:https://support.google.com/webmasters/answer/183668?hl=en
您会在这个示例中找到他们混合图像和视频节点的地方。
<?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>
我在这里查看了图像命名空间的 XSD:http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd
这些节点的架构定义对同级节点没有任何要求,您应该能够将这些混合站点地图节点类型放入 urlset 中。