站点地图(英语:Sitemaps,旧称Google Sitemaps,也写为Sitemap;又称网站地图)是一种列有某个网站所有网址(URL)的XML文件,由Google最先发起。利用Sitemaps协议,网站管理员可以列出网站上可以供搜索引擎抓取的URL,并通知给后者。Sitemaps中包含有关每个URL的其他信息,如URL上次更新的时间、更新的频率以及相对于网站其他URL的重要性。搜索引擎的爬虫可以通过Sitemaps更有效地抓取网站内容,并找到可能与网站其他内容没有相互链接的URL。Sitemaps协议是对robots.txt的补充。[1]

历史 编辑

Google于2005年6月宣布正在进行一项名为Google Sitemaps的实验,以知识共享许可协议发布了免费的Sitemaps 0.84,同时发布了一个Python的开源客户端Sitemap Generator,用于生成常见的一些Sitemaps。Sitemaps发布后,即被包括维基媒体基金会下属站点在内的许多网站采用。2006年11月,Google、雅虎微软Live Search宣布支持Sitemaps 0.90,Sitemaps成为第一个改进搜索引擎爬网过程的联合开放行动。[2][3]Ask.com于2007年4月加入支持Sitemaps的厂商行列[4]。之后,美国亚利桑那州犹他州弗吉尼亚州等州的政府陆续宣布将在其网站上使用Sitemaps[5]

后来,Sitemaps协议基于打造“对爬虫友好的Web服务器”(Crawler-friendly Web Servers)这一想法进行了改进。[6][7]2012年5月,Google宣布,他们正尝试在Sitemaps中添加rel="alternate"herflang英语Hreflang[8]Google表示,使用Sitemaps并不能保证Sitemap中的所有项目都会被抓取并编制索引,但在大多数情况下,站点设置Sitemap是有益的。[9]

文件格式 编辑

Sitemaps协议格式由XML标签组成。文件本身必须为UTF-8编码。Sitemaps也可以只是URL的纯文本列表。[10]以下是仅包含一个URL并使用了所有可选标签的示例。

<?xml version="1.0" encoding="utf-8"?>
<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">
    <url>
        <loc>http://example.com/</loc>
        <lastmod>2006-11-18</lastmod>
        <changefreq>daily</changefreq>
        <priority>0.8</priority>
    </url>
</urlset>

一张站点地图必须以<urlset>开始,并在其中引用命名空间(为协议规范)。以</urlset>结束。中间以<url>……</url>分别列出每个项目,并使用<loc>……</loc>列出URL。站点地图的大小不得超过50MB、50,000个URL,若要列出超过50,000个URL,必须创建多个Sitemap文件,并在一个站点地图索引文件中列出每个站点地图文件。网站地图索引文件不能列出超过50,000个站点地图。[10]

文本文件 编辑

Sitemaps也可以是文本文件中的URL简单列表,XML Sitemaps的文件规范基本适用于文本Sitemaps。该文件必须为UTF-8编码,并且不能超过10MB,也不能包含超过50,000个URL,[11]但可以压缩为gzip文件。[10]

其他站点地图类型 编辑

Google支持Sitemaps协议范围之外的许多其他XML站点地图类型,以允许网站管理员提供有关其网站内容的其他数据。视频和图像的站点地图,旨在提高网站在图像和视频搜索中的排名。[12][13]

视频站点地图(Video Sitemaps)标示在搜索结果中显示的首选缩略图、视频发布日期、视频时长和其他元数据。视频站点地图还用于允许搜索引擎索引嵌入在网站上、但在外部托管(例如VimeoYouTube)的视频[13]图像站点地图(Image Sitemaps)用于标示图像元数据,例如许可信息、地理位置和图像标题。[12]Google新闻站点地图(Google News Sitemaps)受Google支持,可以方便快速地索引新闻主题。[14][15]

参见 编辑

参考资料 编辑

  1. ^ Lotos. 使用Sitemap让搜索引擎更快更全面的收录网站. 黑客防线. 2007, (1). 
  2. ^ Google Blog. Webmaster-friendly. 2005-06-02 [2020-07-29]. (原始内容存档于2005-06-08). 
  3. ^ Major Search Engines Unite to Support a Common Mechanism for Website Submission. Google News from Google. 2006-11-16 [2020-07-29]. (原始内容存档于2019-04-17). 
  4. ^ Sitemaps Autodiscovery. Ask's Official Blog. 2007-04-11 [2020-07-29]. (原始内容存档于2007-05-18). 
  5. ^ Information for Public Sector Organizations. Google. 2007 [2020-07-29]. (原始内容存档于2007-04-30). 
  6. ^ M.L. Nelson; J.A. Smith; del Campo; H. Van de Sompel; X. Liu. Efficient, Automated Web Resource Harvesting (PDF). WIDM'06. 2006 [2020-07-29]. (原始内容存档 (PDF)于2017-12-01). 
  7. ^ O. Brandman, J. Cho, Hector Garcia-Molina, and Narayanan Shivakumar. Crawler-friendly web servers. Proceedings of ACM SIGMETRICS Performance Evaluation Review, Volume 28, Issue 2. 2000. doi:10.1145/362883.362894. 
  8. ^ Multilingual and multinational site annotations in Sitemaps. Google Webmaster Central Blog. Pierre Far. 2012-05-24. (原始内容存档于2016-03-06). 
  9. ^ About Google Sitemaps. 2016-12-01 [2016-12-01]. (原始内容存档于2020-11-11). 
  10. ^ 10.0 10.1 10.2 Sitemaps XML format. Sitemaps.org. 2016-11-21 [2020-07-29]. (原始内容存档于2020-06-20). 
  11. ^ Build and submit a sitemap - Search Console Help. Support.google.com. [2018-08-05]. (原始内容存档于2013-05-17). 
  12. ^ 12.0 12.1 Image Sitemaps. Google Search Console. [2018-12-28]. (原始内容存档于2019-06-23). 
  13. ^ 13.0 13.1 Video Sitemaps. Google Search Console. [2018-12-28]. (原始内容存档于2019-06-23). 
  14. ^ Bigby, Garenne. Why You should be using a Google News Sitemap. Dyno Mapper. [2018-12-28]. (原始内容存档于2018-12-28). 
  15. ^ Google News Sitemaps. Google Search Console. [2018-12-28]. (原始内容存档于2019-06-23). 

外部链接 编辑