向搜尋引擎的網站管理員 (webmaster) 驗證網站並提交網站地圖 (sitemap)

說明
基本上很多類型的網站之流量來源大宗是來自於搜尋引擎 (可安裝 Google Analytics 之類的 JavaScript code 獲得整個流量來源資訊及其細節,流量主要分成「搜尋、連結和直接」來源三大宗種類),所以完成網站以後最好向各搜尋引擎的網站管理員 (webmaster) 驗證自己的網站並提交網站地圖 (sitemap)。

一個網站建構完成以後會建議要為網站建立網站地圖(sitemap)資訊,給人看的「網站地圖頁面」和給搜尋引擎看的「網站地圖檔案」都需要有。

「網站地圖檔案」的格式主要是:
(1) text 檔列舉所有應該被搜尋引找到的網址 (URL);或
(2) XML 格式的網站地圖資訊。詳情可參考 http://www.sitemaps.org/ 裡面的說明。

驗證你的網站
接下來需要到各搜尋引擎的「網站管理員 (webmaster)」頁面去驗證你的網站,以下列出幾個比較大的搜尋引擎的「網站管理員 (webmaster)」所在網址:

1. Google Web Master: https://www.google.com/webmasters/tools/home?hl=zh-TW
2. Bing Web Master: https://ssl.bing.com/webmaster/home
3. BaiDu Web Master: http://zhanzhang.baidu.com/site/index

照各搜尋引擎的「網站管理員」頁面指示,一般驗證方式是:
(1) 在網頁的頁面的 <head> 區段擺放驗證檔案;或
(2) 在網站根目錄擺放 HTML 驗證檔。

以 Google webmaster 為範例,用上傳 HTML 檔案的方式驗證有以下步驟:
a1. 下載 HTML 驗證檔。 [google83746f3w1q6ge57s.html]
a2. 上載檔案至 http://site1.example.com/
a3. 透過瀏覽器前往 http://site1.example.com/google83746f3w1q6ge57s.html 以確認上載成功。
a4. 按一下下方的 [驗證]。

提交網站地圖 – 選項 1
驗證網站完成後會在網站管理員看到多了剛剛驗證完成的網站之項目,點選進去找到提交網站地圖的地方,其所在分別為:

1. Google Web Master: 資訊主頁 > 最佳化 > Sitemap
2. Bing Web Master: 儀表板 > 設定我的網站 > 網站地圖
3. BaiDu Web Master: 需要被邀請的網站才能使用提交 sitemap 功能。

如果「網站地圖檔案」有非常多個,那可以只提交「網站地圖檔案索引檔」即可,該索引檔內記錄所有「網站地圖檔案」的網址 (URL) 在哪。

提交網站地圖 – 選項 2
另外,「網站地圖檔案」或「網站地圖檔案索引檔」也可以寫在 robots.txt 以告知搜尋引擎。其於 robots.txt 中的格式範例如下:

Sitemap: http://site1.example.com/sitemap.xml

Sitemap: http://site1.example.com/sitemap-index.xml

提交網站地圖 – 選項 3
有些搜尋引擎可接受直接傳送一個 HTTP 要求 (HTTP request) 來提交網站地圖,如以下範例:

http://submissions.ask.com/ping?sitemap=http://site1.example.com/sitemap.xml

驗證「網站地圖檔案」或「網站地圖檔案索引檔」 的正確性

以下兩個網址可以用來驗證「網站地圖檔案」或「網站地圖檔案索引檔」 的正確性:
1. http://www.w3.org/XML/Schema#Tools
2. http://www.xml.com/pub/a/2000/12/13/schematools.html

特別要注意的是,需要在 XML 格式的網站地圖(索引)檔案中加上一些檔頭資訊:

「網站地圖檔案 (Sitemaps)」:
<?xml version=’1.0′ encoding=’UTF-8′?>
<urlset 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”
xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″>
<url>

</url>
</urlset>

「網站地圖檔案索引檔 (Sitemap index files)」:
<?xml version=’1.0′ encoding=’UTF-8′?>
<sitemapindex 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/siteindex.xsd”
xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″>
<sitemap>

</sitemap>
</sitemapindex>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.