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,你只能提交該驗證網站的網址,不能出現其他網
站的網址。