简体   繁体   English

XML站点地图中是否需要xsi和架构部分? 他们的意思是什么?

[英]Are the xsi and schema portions needed in an XML sitemap? What do they mean?

For the XML sitemap of my website, I noticed that different articles suggest different things. 对于我网站的XML网站地图,我注意到不同的文章提出了不同的建议。

For example, prior to my page listings, some articles suggest starting it this way: 例如,在我的页面列表之前,一些文章建议以这种方式启动它:

  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 
                       http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

While other articles have it layed out using only: 在其他文章中,仅使用以下内容进行了布局:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

Do I need to include all of the extra stuff from the first example? 我是否需要包括第一个示例中的所有其他内容?

And what exactly is the difference between using the extra parts, or not using them? 使用多余的零件或不使用多余的零件到底有什么区别?

You only need to provide the schema if you want to validate the XML against the Sitemaps.org XSD (or if you use some other XML tool making use of it). 仅当您想根据Sitemaps.org XSD验证XML(或者如果您使用其他利用XML的XML工具)时,才需要提供架构。 See Validating your Sitemap . 请参阅验证站点地图

If you don't need this (and it's likely that you don't, otherwise you probably wouldn't ask), it's sufficient to use 如果您不需要此功能(很可能不需要,否则您可能不会问),那么使用它就足够了

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM