sitemap 配置使用文档
版本:v1.0 | 适用对象:网站开发者、SEO 从业者、站点管理员 配套阅读:robots.txt 使用说明文档(sitemap 通常通过 robots.txt 的
Sitemap指令声明)
一、什么是 sitemap
sitemap(站点地图)是一个列出了网站所有(或重要)可抓取 URL 的文件,用来帮助搜索引擎和爬虫发现并理解网站结构。
如果说 robots.txt 是"门禁规则"(哪里能去),那 sitemap 就是"导览图"(哪里有什么、何时更新过)。
核心作用
发现页面:帮助爬虫找到那些通过常规链接难以到达的页面(深层页面、孤立页面、新页面)
了解更新:通过
lastmod告诉爬虫页面最近修改时间,促进重新抓取结构提示:向爬虫展示站点整体结构与内容关系
与 robots.txt 的关系
两者互补,常配合使用:
二、sitemap 的类型
TXT sitemap 示例
https://www.example.com/
https://www.example.com/about
https://www.example.com/contactTXT 格式每行一个完整 URL,最多 50,000 行。简单但无法提供更新时间等信息。
三、XML sitemap 格式详解
3.1 基本结构
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2026-10-28</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.example.com/about</loc>
<lastmod>2026-10-20</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>3.2 标签详解
3.3 关于 changefreq 和 priority
重要:Google 已基本忽略
changefreq和priority,主要依据lastmod和实际抓取行为判断。百度等也类似。
lastmod务必准确:虚假时间会降低信任changefreq/priority可填可不填,影响很小
3.4 URL 编码要求
<loc> 中的特殊字符必须转义:
示例:https://www.example.com/search?q=a&b → https://www.example.com/search?q=a&b
3.5 容量限制
超过上限需拆分为多个 sitemap,并用 index 文件组织(见第四章)。
四、sitemap index(大型站点)
当 URL 超过 50,000 个或文件超过 50MB 时,使用 sitemap index 统一管理多个子 sitemap。
4.1 结构
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap-products.xml</loc>
<lastmod>2026-10-28</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap-articles.xml</loc>
<lastmod>2026-10-27</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap-images.xml</loc>
<lastmod>2026-10-28</lastmod>
</sitemap>
</sitemapindex>4.2 拆分建议
大型站点常按内容类型/分区拆分,便于维护与监控:
sitemap-products.xml(商品)sitemap-articles.xml(文章)sitemap-categories.xml(分类)sitemap-images.xml(图片)
通过 index 统一引用,单次提交即可覆盖全站。
五、专用 sitemap
5.1 图片 sitemap
帮助 Google 发现图片,常嵌入在普通 sitemap 中:
<url>
<loc>https://www.example.com/article-1</loc>
<image:image xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
<image:loc>https://www.example.com/images/cover.jpg</image:loc>
<image:title>文章封面图</image:title>
<image:caption>描述文字</image:caption>
</image:image>
</url>5.2 视频 sitemap
<url>
<loc>https://www.example.com/video-1</loc>
<video:video xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<video:thumbnail_loc>https://www.example.com/thumb.jpg</video:thumbnail_loc>
<video:title>视频标题</video:title>
<video:description>视频描述</video:description>
<video:content_loc>https://www.example.com/video.mp4</video:content_loc>
<video:duration>120</video:duration>
</video:video>
</url>5.3 新闻 sitemap
用于 Google News,仅列最近 2 天内的新闻,且应频繁更新:
<url>
<loc>https://www.example.com/news/2026-today</loc>
<news:news xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
<news:publication>
<news:name>示例新闻网</news:name>
<news:language>zh-cn</news:language>
</news:publication>
<news:publication_date>2026-10-28T10:00:00+08:00</news:publication_date>
<news:title>今日要闻</news:title>
</news:news>
</url>六、如何提交 sitemap
提交有三种主要途径,建议多管齐下:
6.1 在 robots.txt 中声明(最简单,通用)
Sitemap: https://www.example.com/sitemap.xml支持多个:
Sitemap: https://www.example.com/sitemap.xml
Sitemap: https://www.example.com/sitemap-news.xml该声明对所有遵守协议的爬虫生效,是发现 sitemap 的通用方式。
6.2 各搜索平台手动提交(最有效,可看报告)
手动提交可查看抓取状态、错误报告、收录数量。
6.3 HTTP ping / API 推送(自动通知)
更新后主动通知搜索引擎:
# Bing(仍在用)
https://www.bing.com/ping?sitemap=https://www.example.com/sitemap.xml
# 百度:主动推送 API(需 token)
POST http://data.zz.baidu.com/urls?site=域名&token=你的tokenGoogle 已于 2023 年弃用 sitemap ping API,建议改用 Search Console 提交或 robots.txt 声明。百度推荐用主动推送(API)替代 ping。
七、最佳实践
只放规范 URL:使用规范化后的 URL(统一 https、统一 trailing slash、去重复参数)
lastmod 必须真实:反映实际内容变更,虚假时间损害信任
包含规范页面,排除低质页面:不要放
noindex页面、被 robots.txt 屏蔽的页面、404、重定向链与 robots.txt 配合:在 robots.txt 声明 sitemap 位置;确保 sitemap 中的 URL 不被 robots.txt
Disallow(否则矛盾且无效)动态生成:大型/内容型站点应程序化生成 sitemap,内容更新时自动刷新
压缩传输:可用 gzip 生成
sitemap.xml.gz,减少带宽保持更新:新增页面及时加入,删除页面及时移除
不要把 sitemap 当作收录保证:提交 ≠ 收录,仍取决于内容质量与抓取预算
八、常见误区
九、GEO:sitemap 与生成式 AI 引擎
9.1 sitemap 在 GEO 中的角色
GEO(生成式引擎优化)时代,sitemap 仍是内容发现的基础设施——AI 爬虫(GPTBot、PerplexityBot、ClaudeBot 等)同样先读 robots.txt 再按 sitemap 发现内容。
与 SEO 一致,sitemap 对 GEO 的价值在于:
让 AI 爬虫快速发现你的全部内容,尤其是深层/新发布页面
通过
lastmod标注内容新鲜度,AI 引擎对时效性内容(新闻、资讯)更敏感
9.2 GEO 视角下的建议
结构化拆分:按主题/内容类型分 sitemap(如
sitemap-guides.xml、sitemap-faq.xml),AI 引擎更易按主题理解站点保证 FAQ/百科类内容被抓取:这类内容正是 AI 回答的高频引用源,确保它们在 sitemap 中且未被 robots.txt 屏蔽
lastmod准确:AI 引擎偏好最新信息,准确的lastmod有助于内容被及时纳入回答确认未被 AI 爬虫屏蔽:若你选择 GEO"策略 B/C"(见 robots.txt 文档第九章),需注意——屏蔽 AI 爬虫后,sitemap 对该 AI 引擎也失效了。即想被某 AI 引用,就不能在 robots.txt 里
Disallow它的检索爬虫。
简言之:sitemap 负责"让 AI 找到你",robots.txt 决定"让不让 AI 抓"。两者配合才完整。
十、验证与参考
验证工具
官方规范
sitemaps.org 协议:https://www.sitemaps.org/protocol.html
Google 图片 sitemap:https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps
Google 视频 sitemap:https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps
Google 新闻 sitemap:https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap
十一、一句话总结
sitemap 是给爬虫的"导览图":它告诉爬虫站里有哪些页面、何时更新过,帮助发现深层与新内容。它和 robots.txt 是一对互补工具——robots.txt 管"别抓什么",sitemap 管"请抓这些"。在 GEO 时代,sitemap 同样是 AI 引擎发现内容的入口,但前提是你在 robots.txt 里没有屏蔽对应的 AI 爬虫。