Sitemap站点地图,即网站上各网页的列表:
1)有助于百度发现并了解网站上所有网页;
2)可以使用Sitemap提供网站的相关信息,如更新日期、更新频率等;
Sitemap的格式:
1)txt文本格式:
在txt文本中列出需要向百度提交的链接地址,提交的地址需注意:
①文本文件中每行必须有一个网址,网址中不能有换行和其他符号以及中文;
②网址必须完整,http开头;
③每个文本中最多包含50000个网址,且小于10MB,如果多于50000个,可以将
列表分割成多个文本文件;
④文本文件需使用UTF-8或GBK编码;
2)xml格式:
单个xml数据格式:
<?xml version="1.0" encoding="utf-8"?>
<!-- XML 文件需以 utf-8 编码-->
<urlset>
<!--必填标签-->
<url>
<!--必填标签,这是具体某一个链接的定义入口,每一条数据都要用<url>和</url>包含在里面,这是必须的 -->
<loc>http://www.yoursite.com/yoursite.html</loc>
<!--必填,URL 链接地址,长度不得超过 256 字节-->
<lastmod>2009-12-14</lastmod>
<!--可以不提交该标签,用来指定该链接的最后更新时间-->
<changefreq>daily</changefreq>
<!--可以不提交该标签,用这个标签告诉此链接可能会出现的更新频率 -->
<priority>0.8</priority>
<!--可以不提交该标签,用来指定此链接相对于其他链接的优先权比值,此值定于 0.0-1.0 之间-->
</url>
<url>
<loc>http://www.yoursite.com/yoursite2.html</loc>
<lastmod>2010-05-01</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
</urlset>
上面向百度提交了一个http://www.yoursite.com/yoursite.html链接;
若有多条url提交,重复<url></url>之间的片段;
3)Sitemap索引格式:
如需提交大量Sitemap文件,可以将其列在Sitemap索引文件中,将该索引文件提
交,如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- XML 文件需以 utf-8 编码-->
<sitemapindex>
<!--必填,以 <sitemapindex> 开始标记作为开始,以 </sitemapindex> 结束标记作为结束-->
<sitemap>
<!--必填,以<sitemap>标签提交一个子 sitemap 文件-->
<loc>http://example.com/ext/xmlsitemap/add/201201/index_20120106.xml</loc>
<!--必填,识别 sitemap 的位置-->
<lastmod>2009-12-14</lastmod>
<!--选填,识别相对 sitemap 文件的修改时间-->
</sitemap>
<!--必填,标签闭合-->
</sitemapindex>
<!--必填,标签闭合-->
有多个Sitemap,按照上述格式重复<sitemap></sitemap>之间的片断;
移动Sitemap协议:
用于将网址提交给移动搜索搜录,增加如下标签:
1)mobile:mobile/ :移动网页
2)<mobile:mobile type=“mobile”/> :移动网页
3)<mobile:mobile type=“autoadapt”/>:自适配网页,适用于同一网址页面,会随
设备不同改变展现的情况。
如下事例:
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">
<!-- 向百度移动搜索提交-->
<url>
<loc>http://m.example.com/index.html</loc>
<mobile:mobile type="mobile"/>
<lastmod>2009-12-14</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
<!-- 向百度pc搜索提交-->
<url>
<loc>http://www.example.com/index.html</loc>
<lastmod>2009-12-14</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
<!-- 向百度移动和pc搜索都提交-->
<url>
<loc>http://www.example.com/autoadapt.html</loc>
<mobile:mobile type="autoadapt"/>
<lastmod>2009-12-14</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
</urlset>
注意事项:
1)如果验证了网站的主域,那么 Sitemap 文件中可包含该网站主域下的所有网址;
2)如果验证的 www.example.com,你只能提交该验证网站的网址,不能出现其他网
站的网址。