maketop’s blog

Just another WordPress weblog

SiteMap Protocol一种站点地图协议,由Google, MSN, Yahoo共同推出。这个协议定义了如何定义一个网站地图以便于搜索引擎的收录。对协议本身的讨论已经比较多了,可以通过官方网站学习详细的协议内容。

SiteMap Index则解决了如果网站存在多个SiteMap文件的情况下如何处理。在SiteMap Protocol中定义通过<sitemapindex>标签来定义多个sitemap文件的位置。语法方式为

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>http://www.example.com/sitemap1.xml.gz</loc>
      <lastmod>2004-10-01T18:23:17+00:00</lastmod>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap2.xml.gz</loc>
      <lastmod>2005-01-01</lastmod>
   </sitemap>
</sitemapindex>

每一个<sitemap>标签定义一个sitemap文件,<loc>标签定义文件位置,<lastmod>则定义了最近修改时间。<lastmod>支持 YYYY-MM-DDThh:mm:ssTZD, YYYY-MM-DDThh:mmTZD,YYYY-MM-DD格式。

编辑完成这个文件后,将文件按以下语法放到robots.txt文件中。

Sitemap: <your_sitemap_index_file_location>

必须注意的是,这个文件必须是utf-8编码格式。

Posted by admin on Tuesday, March 24th, 2009

Post A Comment

You must be logged in to post a comment.

    Popular Post

    Most Commented Posts

    Random Posts