Sitemap
Sitemap 幫助搜尋引擎發現 URL。常見為 XML sitemap;大量 URL 時使用 sitemap index 拆分管理。
定義
Sitemap 是提供網站 URL 清單的機制,讓搜尋引擎更有效率地發現、爬取與更新內容。最常見的是 XML sitemap(sitemap.xml),大型站或 pSEO 站會使用 sitemap index 來拆分多個 sitemap。
為什麼重要
- 加速新頁面被發現與爬取
- 降低 crawl waste(爬蟲把資源花在不重要的頁)
- 多語言與大量內容時更容易控管收錄範圍
- 幫助爬蟲發現孤立頁面(沒有內鏈的頁面)
- 提供 lastmod 讓搜尋引擎知道內容更新時間
- 是 Search Console 監控索引狀態的重要資料來源
- 支援影片、圖片、新聞等特殊內容的額外標記
怎麼做(實作重點)
- 只放 canonical + indexable URL(不要放 noindex、redirect、404)
- URL 過多就拆分並使用 sitemap index
- 在 robots.txt 加上 Sitemap: 指令
- 在 Search Console / Bing 提交並監控覆蓋率
- 保持 lastmod 準確(只在內容真正更新時改)
- 使用程式自動產生(建置時或 cron job)
- 定期檢查 sitemap 裡的 URL 都回傳 200
範例
xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2025-01-15</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/learn/seo-basics</loc>
<lastmod>2025-01-10</lastmod>
</url>
</urlset>xml
<!-- sitemap index(大型站拆分用) -->
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-pages.xml</loc>
<lastmod>2025-01-15</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-glossary.xml</loc>
<lastmod>2025-01-12</lastmod>
</sitemap>
</sitemapindex>相關連結
常見問題
關於這個詞彙的常見問答。