CaelLab​(留言 | 贡献)
小无编辑摘要
IdleTap-bot​(留言 | 贡献)
移除 Languages 模板(已清理多语言翻译条目)
 
(未显示3个用户的5个中间版本)
第1行: 第1行:
{| class="infobox vcard" style="float:right; margin:0 0 1em 1em; width:22em;"
{| class="infobox" style="border:1px solid #ccc; background:#f8f9fa; width:24em; float:right; margin:0 0 1em 1em; border-spacing:5px;"
|+ Sitemap
! colspan="2" style="text-align:center;" |'''Sitemap'''
|-
|-
| colspan="2" style="text-align:center;" |
|中文名
|站点地图
|-
|-
! 其他名称
|[[英文]]名
| 站点地图、网站地图
|Sitemap
|-
|-
! 初始发布
|协议版本
| 2005年6月
|0.9(sitemaps.org)
|-
|-
! 协议版本
|首发时间
| 0.9
|2005年6月
|-
|-
! 支持格式
|首发机构
| XML、HTML、TXT等
|[[Google]]
|-
|-
! 开发者
|标准制定机构
| Google、Yahoo!、Microsoft
|[[Google]]、[[Yahoo!]]、[[Microsoft]](联合)
|-
|-
|文件扩展名
|.xml、.xml.gz、.txt
|-
|格式类型
|XML / 纯[[文本]]
|-
|标准网站
|[[WWW|www]].sitemaps.org
|}
'''Sitemap'''(全称:Sitemaps Protocol,中文常译为“站点地图协议”)是一种用于告知[[搜索引擎]]网站上可供抓取的网页地址列表的开放协议标准。网站管理员可将网站中的网页[[URL]]制作成标准化的Sitemap文件,以指引搜索引擎[[爬虫]](Crawler或Sp[[IDE|ide]]r)快速、全面地抓取或更新网站内容<ref name="b[[AI|ai]]du-sitemap">[http://tousu.baidu.com/question2?prod_en=master&class=471&id=3032 百度Sitemap协议 - 百度用户服务中心]</ref><ref name="ziyuan-baidu">[https://ziyuan.baidu.com/wiki/44 Sitemap提交工具 - 百度资源平台]</ref>。该协议最初由[[Google]]在2005年6月推出,后于2006年11月获得[[微软]]([[Microsoft]])和[[雅虎]]([[Yahoo!]])的共同支持,形成了行业统一的Sitemaps 0.9协议标准<ref name="google-first">[https://www.w3.org/2007/06/eGov-dc/papers/Google_Sitemaps_Position_Paper.pdf Ensuring government is only one search away: Implementing the Sitemap protocol - W3C Position Paper]</ref><ref name="unified-2006">[https://news.zol.com.cn/46/463479.html Google/雅虎/微软宣布统一站点地图标准 - ZOL新闻]</ref>。Sitemap文件作为URL包含协议,与作为URL排除协议的[[robots.txt]]相互补充,共同帮助搜索引擎更高效地发现网站内容<ref name="seo-best-practices">[https://seo.yiguotech.com/archives/xml-sitemap-best-practices XML Sitemap 最佳实践:让搜索引擎准确发现你的每一个重要页面]</ref>。
== 历史 ==
Sitemap协议最初由[[Google]]于2005年6月以Sitemaps 0.84版本推出,旨在让网站开发者能够发布其站点中所有页面的链接列表,从而改善大型动态网站的搜索引擎发现机制<ref name="google-first" /><ref name="history-dirzon">[https://www.dirzon.com/file/telegram/Ebook%20Gallery/Digital%20Marketing%20Handbook.pdf Digital Marketing Handbook - Sitemaps History]</ref>。2006年11月,[[Google]]、[[Yahoo!]]和[[Microsoft]]宣布联合支持该协议,并将命名空间版本变更为Sitemap 0.90<ref name="unified-2006" /><ref name="dirzon-history">[https://www.dirzon.com/file/telegram/Ebook%20Gallery/Digital%20Marketing%20Handbook.pdf Digital Marketing Handbook - Sitemaps History]</ref>。此后,三家公司共同启动了Sitemaps.org计划,为网站管理员提供统一的协议指引<ref name="search-engine-journal">[https://www.searchenginejournal.com/google-yahoo-microsoft-team-for-sitemapsorg-search-engine-indexing-initiative/4002/ Google, Yahoo & Microsoft Team for Sitemaps.org - Search Engine Journal]</ref>。
2007年4月,[[Ask.com]]和[[IBM]]宣布加入对Sitemaps协议的支持行列<ref name="ask-ibm">[https://smb.zol.com.cn/54/540616.html 三巨头更新Sitemap协议 IBM与Ask加盟 - ZOL]</ref>。同年,[[Google]]、[[Yahoo!]]和[[微软]]在Sitemap协议中加入了通过robots.txt自动发现Sitemap文件的功能<ref name="auto-discovery">[https://news.pconline.com.cn/nw/0704/998754.html Google、微软和雅虎增强Sitemap协议 - PConline]</ref>。截至目前,Sitemaps.org官方网站已拥有18个语种的版本,Sitemap协议被[[全球]]主流搜索引擎广泛采纳<ref name="auto-discovery" />。
== 文件格式与规范 ==
Sitemap协议支持多种文件格式:XML格式、纯文本(TXT)格式、RSS/Atom格式以及Sitemap索引(Sitemap Index)格式<ref name="ziyuan-baidu" /><ref name="ryte-formats">[https://en.ryte.com/wiki/Sitemap Sitemap - Ryte Wiki]</ref>。
=== XML格式 ===
XML格式是应用最为广泛的标准格式,文件采用UTF-8编码,根节点为'''<code>&lt;urlset&gt;</code>''',并声明命名空间为http://www.sitemaps.org/schemas/sitemap/0.9<ref name="baidu-sitemap" /><ref name="xml-structure">[https://seo.yiguotech.com/archives/xml-sitemap-best-practices XML Sitemap 最佳实践:语法与结构]</ref>。
每个URL条目('''<code>&lt;url&gt;</code>''')包含以下子元素:
* '''<code>&lt;loc&gt;</code>''':页面的完整URL(含协议,必需)<ref name="woorank-tags">[https://www.woorank.com/en/edu/seo-guides/xml-sitemaps What is an XML Sitemap? - Woorank]</ref><ref name="prog[[RAM|ram]]mersought">[https://programmersought.com/article/17769717359/ Site SEO Optimization SiteMap Protocol - ProgrammerSought]</ref>。
* '''<code>&lt;lastmod&gt;</code>''':页面最后修改日期(可选,格式为[[W3C]] Datetime或YYYY-MM-DD)<ref name="woorank-tags" /><ref name="prog[[RAM|ram]]mersought" />。
* '''<code>&lt;changefreq&gt;</code>''':页面可能发生更改的频率(可选,有效值:always、hourly、daily、weekly、monthly、yearly、never)<ref name="baidu-format-detail">[https://ziyuan.baidu.com/wiki/44 百度Sitemap提交工具 - 格式说明]</ref><ref name="programmersought" />。
* '''<code>&lt;priority&gt;</code>''':该页面在站内的相对优先级(可选,范围0.0至1.0)<ref name="baidu-format-detail" /><ref name="programmersought" />。
实际使用中,[[Google]]官方文档已明确表示'''<code>&lt;changefreq&gt;</code>'''和'''<code>&lt;priority&gt;</code>'''两个标签在多数情况下被忽略,仅有'''<code>&lt;lastmod&gt;</code>'''在[[数据]]准确时被参考<ref name="seo-best-practices" /><ref name="ujcms-google">[https://www.ujcms.com/articles/63304510210828801.html Sitemap格式与提交 - UJCMS]</ref>。
=== 纯文本(TXT)格式 ===
纯文本格式是一种更为简单的Sitemap实现方式。网站管理员可以创建一个纯文本文件(扩展名为.txt),文件中每行包含一个完整的URL地址。该文件同样需遵循容量限制,且必须使用UTF-8或GBK编码<ref name="baidu-sitemap" /><ref name="baidu-txt">[https://ziyuan.baidu.com/wiki/44 百度Sitemap提交工具 - TXT格式说明]</ref>。URL必须是完整路径(含[[HTTP|http]]://或[[HTTPS|https]]://),文件中不得包含网址列表以外的任何信息<ref name="baidu-sitemap" />。
纯文本Sitemap文件的示例内容如下:
<pre>
https://www.example.com/
https://www.example.com/about/
https://www.example.com/contact/
https://www.example.com/products/
</pre>
纯文本格式适合小型网站或需要快速提交URL列表的场景。与XML格式相比,纯文本格式不支持'''<code>&lt;lastmod&gt;</code>'''、'''<code>&lt;changefreq&gt;</code>'''和'''<code>&lt;priority&gt;</code>'''等元数据,但具有更低的创建门槛和更快的解析速度<ref name="baidu-txt" /><ref name="ryte-formats" />。
=== Sitemap索引格式 ===
当网站包含的URL数量超过单个Sitemap文件的容量限制时,可使用Sitemap索引文件(Sitemap Index)将多个Sitemap文件聚合在一起。Sitemap索引文件本身是一个XML文件,根节点为'''<code>&lt;sitemapindex&gt;</code>''',每个子Sitemap通过'''<code>&lt;sitemap&gt;</code>'''和'''<code>&lt;loc&gt;</code>'''标签指定其位置<ref name="baidu-sitemap" /><ref name="woorank-index">[https://www.woorank.com/en/edu/seo-guides/xml-sitemaps#sitemap-index-example Woorank Sitemap Guide - Sitemap Index]</ref>。
Sitemap索引文件示例:
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt;
  &lt;sitemap&gt;
    &lt;loc&gt;https://www.example.com/sitemap1.xml&lt;/loc&gt;
    &lt;lastmod&gt;2024-10-01&lt;/lastmod&gt;
  &lt;/sitemap&gt;
  &lt;sitemap&gt;
    &lt;loc&gt;https://www.example.com/sitemap2.xml&lt;/loc&gt;
    &lt;lastmod&gt;2024-10-01&lt;/lastmod&gt;
  &lt;/sitemap&gt;
&lt;/sitemapindex&gt;
</pre>
Sitemap索引文件本身也受容量限制,每个索引文件最多可包含50,000个子Sitemap条目<ref name="baidu-sitemap" />。
=== RSS/Atom格式 ===
RSS 2.0和Atom 1.0格式也可作为Sitemap使用。搜索引擎通过读取RSS/Atom feed中的条目URL来发现网站内容。这种格式通常由内容管理系统(CMS)自动生成,特别适合以文章、视频等内容为主的网站<ref name="ryte-formats" /><ref name="aliyun-formats">[https://developer.aliyun.com/article/1464177 建站SEO优化之站点地图sitemap - 阿里云开发者]</ref>。与XML Sitemap格式相比,RSS/Atom feed提供的时间戳信息通常更准确,因为它们反映了内容的实际发布时间。
=== 技术限制 ===
根据W3C标准和主流搜索引擎的规范,单个Sitemap文件最多可包含50,000个URL,未压缩体积不得超过50MB([[Google]]规范)或10MB([[百度]]规范)<ref name="developer-baidu">[https://developer.baidu.com/article/detail.html?id=5780853 网站地图生成技术解析 - 百度开发者中心]</ref><ref name="baidu-sitemap" /><ref name="chinaz-li[[MIT|mit]]s">[https://m.chinaz.com/2026/0524/1639919.shtml 网站创建Sitemap时有哪些注意事项? - Chinaz]</ref>。URL长度限制为2,048个字符<ref name="developer-baidu" /><ref name="woorank-tags" />。对于超过限制的超大型网站,可使用Sitemap索引文件将多个Sitemap文件聚合提交<ref name="baidu-sitemap" /><ref name="woorank-index" />。此外,Sitemap文件可采用gzip格式压缩(扩展名为.xml.gz或.txt.gz)以节省带宽<ref name="baidu-sitemap" /><ref name="[[golang]]-sitemap">[https://pkg.go.dev/github.com/shuLhan/go-xml/sitemap Sitemap Package - Go Packages]</ref>。
不同搜索引擎对Sitemap文件大小的具体要求如下:
{| class="wikitable"
|-
! 搜索引擎 !! 单个文件容量上限 !! URL数量上限
|-
| [[Google]] || 50 MB(未压缩) || 50,000条
|-
| [[百度]] || 10 MB(未压缩) || 50,000条
|-
| [[Bing]] || 50 MB(未压缩) || 50,000条
|}
|}


Sitemap(也译作站点地图、网站地图)是用于描述网站域名下页面、文件等资源的列表文件,其核心作用是为网站访问者或网络爬虫提供网站的资源结构信息,辅助导航与内容抓取。在英文语境中,首字母大写的'''Sitemap'''通常特指XML格式的爬虫专用站点地图,而小写的'''site map'''则可泛指所有类型的站点地图<ref>https://blog.csdn.net/qq3559727/article/details/52412742</ref>。根据面向对象的不同,Sitemap可分为面向普通用户的导航型站点地图,以及面向搜索引擎爬虫的结构化站点地图,其中XML格式的Sitemaps协议已成为主流搜索引擎通用的站点信息提交标准<ref>https://en.wikipedia.org/wiki/Site_map</ref>。
== Sitemap的创建方法 ==
=== 手动创建 ===
对于小型网站,网站管理员可以手动创建Sitemap文件。XML格式需要遵循sitemaps.org协议规范,使用标准的XML标签结构<ref name="hostinger">[https://www.hostinger.com/ng/tutorials/submit-website-to-search-engines How to submit your website to search engines - Hostinger]</ref><ref name="programmersought" />。纯文本格式则更为简单,只需将URL逐行列出即可<ref name="baidu-txt" />。手动创建适合URL数量较少且不频繁变动的网站。
 
=== 使用生成工具 ===
大多数现代内容管理系统(CMS)提供自动化的Sitemap生成功能:
* '''[[WordPress]]''':可通过Yoast SEO、Rank Math等插件自动生成并定期更新Sitemap文件,通常位于''/sitemap_index.xml''路径<ref name="hostinger" /><ref name="wordpress-lightweight">[https://mai.wordpress.org/plugins/lightweight-sitemap-generator/ Lightweight Sitemap Generator - WordPress Plugin]</ref>。
* '''其他CMS平台''':[[Joomla]]、[[Drupal]]、织梦CMS等均有相应的Sitemap扩展模块或内置功能<ref name="chinaz-sub[[MIT|mit]]">[https://shuyeidc.com/wp/350568.html 如何在robots里面提交网站地图 - ShuyeIDC]</ref>。
* '''在线生成器''':对于静态网站或不支持自动生成功能的网站,可使用在线Sitemap生成工具(如xml-sitemaps.com、Apify Sitemap Generator),通过爬取网站页面自动生成符合规范的Sitemap文件<ref name="apify">[https://apify.com/ XML Sitemap Generator - Apify]</ref><ref name="searchengineland">[https://searchengineland.com/ Sitemap Generator Tool - Search Engine Land]</ref>。
* '''脚本生成''':技术团队可编写脚本(如[[Python]]、[[PHP]]、[[Go]]等语言)定期生成并更新Sitemap文件,并通过计划任务(cron job)实现自动化<ref name="wp-cron">[https://www.digitalocus.com/how-to-update-sitemap/ How to Update Sitemap for Better SEO Performance? - Digitalocus]</ref>。
 
== 向搜索引擎提交Sitemap ==
=== 通过robots.txt提交 ===
将Sitemap文件的位置添加到网站根目录的robots.txt文件中,是告知搜索引擎存在Sitemap的标准方法之一。搜索引擎爬虫在访问网站时首先会读取robots.txt文件,从而发现Sitemap的URL<ref name="auto-discovery" /><ref name="robots-sitemap">[https://developers.google.cn/search/docs/crawling-indexing/robots/create-robots-txt robots.txt文件建立指南 - Google Developers]</ref>。


robots.txt文件中添加Sitemap指令的语法:
<pre>
User-agent: *
Disallow: /admin/
Disallow: /private/
Sitemap: https://www.example.com/sitemap.xml
Sitemap: https://www.example.com/sitemap-news.xml
</pre>
Sitemap指令不区分大小写,可出现在robots.txt文件的任何位置,建议放在文件末尾。如果网站有多个Sitemap文件,可以添加多个Sitemap指令<ref name="robots-sitemap-multiple">[https://shuyeidc.com/wp/350568.html 如何在robots里面提交网站地图 - ShuyeIDC]</ref><ref name="chinaz-robots">[https://shuyeidc.com/wp/350568.html 如何在robots里面提交网站地图 - ShuyeIDC]</ref>。


== 类型 ==
=== 通过搜索引擎站长工具提交 ===
Sitemap根据设计目标与使用对象的不同,主要分为三类:
各大搜索引擎均提供站长工具或资源平台,供网站管理员手动提交Sitemap文件:
=== 规划型站点地图 ===
* '''[[Google Search Console]]''':登录后选择目标网站,在左侧导航栏中找到“Sitemaps”选项,输入Sitemap文件的完整URL并点击提交<ref name="google-search-console">[https://en.ryte.com/wiki/XML_Sitemap XML Sitemap - Ryte]</ref><ref name="hostinger-gsc">[https://www.hostinger.com/ng/tutorials/submit-website-to-search-engines How to submit your website to search engines - Hostinger]</ref>。
这类站点地图是网站设计师在网站开发规划阶段使用的原型文档,用于梳理网站的页面层级与功能结构,辅助开发团队明确网站的整体架构,不会对外发布。
* '''[[Bing Webmaster Tools]]''':登录[[Bing]]站长平台,选择目标网站,在左侧菜单栏中找到“Sitemaps”选项,输入Sitemap URL并提交<ref name="bing-submit">[https://learn.microsoft.com/en-us/answers/questions/5675263/pro-sites-sitemap-submission-in-bing Pro-Sites sitemap submission in Bing - Microsoft Q&A]</ref><ref name="bing-submit2">[https://www.hostinger.com/ng/tutorials/submit-website-to-search-engines How to submit your website to search engines - Hostinger]</ref>。
=== 用户可见站点地图 ===
* '''[[百度搜索资源平台]]''':登录百度站长平台,在“数据提交”或“链接提交”模块中找到Sitemap提交入口,输入Sitemap文件的完整路径并提交。百度要求Sitemap文件必须放置在网站根目录下,且仅对已验证站点开放提交功能<ref name="baidu-submit">[https://zy.baidu.com/ 百度搜索资源平台 - Sitemap提交]</ref><ref name="baidu-submit2">[https://jingyan.baidu.com/article/ 如何提交网站地图给百度 - 百度经验]</ref>。
这类站点地图通常以HTML页面的形式呈现,以层级化的列表展示网站的重要页面链接,面向网站的普通访问者,帮助用户快速定位所需内容,同时也可辅助网络爬虫了解网站结构<ref>https://www.techopedia.com/definition/site-map</ref>。部分站点会采用按字母排序的索引式站点地图,作为层级化站点地图的补充。
=== 爬虫专用结构化站点地图 ===
这类站点地图是为网络爬虫(尤其是搜索引擎爬虫)设计的结构化文件,其中最主流的是XML格式的Sitemaps,此外也存在TXT格式的纯URL列表等形式。这类文件可以向爬虫明确告知网站内的可抓取资源,尤其适用于包含大量动态页面、无法通过普通链接被爬虫发现的网站<ref>https://en.wikipedia.org/wiki/Site_map</ref>。在此基础上,还衍生出了图片Sitemap、视频Sitemap等特化类型,用于向搜索引擎提交网站内的多媒体资源信息。


== XML Sitemaps协议 ==
=== 通过Ping通知提交 ===
XML Sitemaps是目前应用最广泛的爬虫专用Sitemap格式,其对应的Sitemaps协议由Google主导制定,后成为各大搜索引擎共同支持的标准。
[[Google]]提供了Ping通知机制,允许网站管理员在Sitemap文件更新后主动通知Google进行抓取<ref name="google-ping">[https://developers.google.cn/search/docs/crawling-indexing/sitemaps/build-sitemap Google Sitemap构建指南 - Google Developers]</ref>。Ping请求的格式为:
=== 协议规范 ===
<pre>
Sitemaps协议规定,XML格式的Sitemap文件必须采用UTF-8编码,文件内的所有数据值需进行实体转义。文件中可包含每个URL的相关元信息,包括:
https://www.google.com/ping?sitemap=https://www.example.com/sitemap.xml
* <code>loc</code>:资源的URL地址
</pre>
* <code>lastmod</code>:资源的最后修改时间
提交后,Google会在适当的时候重新抓取Sitemap文件。Ping机制仅用于通知Sitemap已更新,不应频繁提交未变更的Sitemap文件<ref name="ujcms-google" />。[[Bing]]也提供类似的通知端点:
* <code>changefreq</code>:资源的更新频率(仅作参考,部分搜索引擎已忽略该字段)
<pre>
* <code>priority</code>:资源的相对优先级(仅作参考,部分搜索引擎已忽略该字段)
https://www.bing.com/ping?sitemap=https://www.example.com/sitemap.xml
<ref>https://support.google.com/webmasters/answer/183668</ref>
</pre>
对于包含大量URL的网站,还可使用Sitemap索引文件,将多个Sitemap文件整合在一起提交,单个Sitemap文件最多可包含5万条URL。
=== 示例 ===
以下是一个简单的XML Sitemap示例,包含三个页面的信息:
<source lang=xml>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>http://www.example.net/?id=who</loc>
    <lastmod>2009-09-22</lastmod>
  </url>
  <url>
    <loc>http://www.example.net/?id=what</loc>
    <lastmod>2009-09-22</lastmod>
  </url>
  <url>
    <loc>http://www.example.net/?id=how</loc>
    <lastmod>2009-09-22</lastmod>
  </url>
</urlset>
</source>


== 历史 ==
== Sitemap的作用与局限 ==
2005年6月,Google首次推出Sitemaps 0.84版本,旨在帮助网站开发者向搜索引擎提交网站内的链接列表,解决动态页面难以被爬虫发现的问题<ref>https://en.wikipedia.org/wiki/Sitemaps</ref>。
Sitemap不直接影响页面的搜索引擎排名。[[Google]]官方已明确表示,Sitemap属于“发现(Discovery)”阶段的工具,而非“排名(Ranking)”信号<ref name="yige-google">[https://www.yige-tech.com/article/Sitemap-zhongji-zhinan-2025.html Sitemap网站地图终极指南(2025实战进阶版) - Yige Tech]</ref><ref name="google-sitemap-role">[https://developers.google.cn/search/docs/crawling-indexing/sitemaps/overview 什么是Sitemap - Google Search Central]</ref>。
2006年11月,Google、Yahoo!与Microsoft(旗下必应搜索引擎)共同宣布联合支持Sitemaps协议,统一了站点地图的标准格式,使得网站开发者只需提交一份Sitemap即可被所有支持该协议的搜索引擎识别<ref>https://www.oreilly.com/library/view/web-site-design/9780596527265/ch04s04.html</ref>。此后,Ask等其他主流搜索引擎也陆续加入对该协议的支持,Sitemaps逐步成为搜索引擎优化(SEO)领域的标准工具之一。
 
Sitemap的主要作用包括:
* 帮助搜索引擎发现新发布的页面,特别是缺乏外部链接的新网站或新建页面。
* 发现网站中的“孤儿页面”(没有其他页面链接指向的页面)。
* 提供页面的最后更新时间等信息,帮助搜索引擎优化抓取调度。
* 告知搜索引擎网站中重要的多媒体内容(图片、视频、新闻等)的位置。
 
Sitemap的局限性:
* 是建议而非命令:搜索引擎可以选择不抓取Sitemap中列出的URL,Sitemap不保证页面一定会被索引<ref name="seo-best-practices" /><ref name="woorank-tags" />。
* 不替代内部链接:良好的网站内部链接结构仍然是搜索引擎发现页面的最主要方式,Sitemap不能替代完善的内部链接策略<ref name="yige-google" /><ref name="google-sitemap-need">[https://developers.google.cn/search/docs/crawling-indexing/sitemaps/overview 何时需要使用Sitemap - Google Search Central]</ref>。
* 不包含不相关内容:Sitemap中不应包含404错误页面、301重定向页面或Noindex页面,这些“脏数据”会降低搜索引擎对网站的信任度<ref name="yige-google" />。
 
=== 何时需要使用Sitemap ===
根据[[Google]]官方建议,以下情况强烈推荐使用Sitemap<ref name="google-sitemap-need" />:
* 网站规模极大(包含大量页面),内部链接难以覆盖所有页面。
* 网站为新网站,几乎没有任何外部链接指向。
* 网站包含大量富媒体内容(视频、图片)或新闻内容,需要搜索引擎更好地理解这些内容。
* 网站页面动态生成,或通过AJAX、[[Java]]Script等方式加载内容。
 
对于小型且内部链接完善、所有重要页面均能从[[首页]]直达的网站,Sitemap并非必需。
 
== Sitemap扩展协议 ==
Sitemap协议在标准XML格式之外还支持针对特定内容类型的扩展命名空间,帮助搜索引擎更准确地理解和索引富媒体内容<ref name="golang-sitemap" /><ref name="google-extensions">[https://developers.google.cn/search/docs/crawling-indexing/sitemaps/overview 什么是Sitemap - Google Search Central]</ref>。
 
=== 图片扩展 ===
图片Sitemap扩展('''<code>&lt;image:image&gt;</code>'''命名空间)允许在标准Sitemap中为每个URL添加图片相关信息。搜索引擎可以利用这些信息更好地发现和索引网站中的图片内容,增加图片在图片搜索中展示的机会<ref name="google-extensions" /><ref name="go-pkg-extensions">[https://pkg.go.dev/github.com/aafeher/go-sitemap-parser go-sitemap-parser - Go Packages]</ref>。
 
=== 视频扩展 ===
视频Sitemap扩展('''<code>&lt;video:video&gt;</code>'''命名空间)支持提供视频的详细信息,包括视频时长、播放时长、内容评级、适龄分级以及视频缩略图URL等<ref name="google-extensions" /><ref name="go-pkg-extensions" />。这有助于搜索引擎在搜索结果中正确展示视频预览和相关信息。
 
=== 新闻扩展 ===
新闻Sitemap扩展('''<code>&lt;news:news&gt;</code>'''命名空间)专门面向新闻类网站,用于提供新闻报道的标题、发布日期等信息。[[Google新闻]]会利用这些信息将内容纳入新闻搜索索引<ref name="google-extensions" /><ref name="go-pkg-extensions" />。
 
=== 多语言/多地区扩展 ===
hreflang扩展('''<code>&lt;xhtml:link rel="alternate" hreflang="..." /&gt;</code>''')允许网站管理员在同一Sitemap中指定页面的多语言或多地区版本。这对于面向不同语言[[用户]]群体的国际化网站尤为重要,有助于搜索引擎向用户呈现正确的语言版本<ref name="go-pkg-extensions" /><ref name="woorank-hreflang">[https://www.woorank.com/en/edu/seo-guides/xml-sitemaps What is an XML Sitemap? - Woorank]</ref>。
 
=== 扩展命名空间声明示例 ===
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
        xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml"&gt;
  &lt;url&gt;
    &lt;loc&gt;https://www.example.com/article&lt;/loc&gt;
    &lt;image:image&gt;
      &lt;image:loc&gt;https://www.example.com/image.jpg&lt;/image:loc&gt;
    &lt;/image:image&gt;
  &lt;/url&gt;
&lt;/urlset&gt;
</pre>
 
== Sitemap的维护与更新 ==
Sitemap文件需要保持与网站内容的同步。最佳实践包括:
* '''定期更新''':当网站添加新页面、修改现有页面或删除页面时,应及时更新Sitemap文件。对于内容频繁变动的网站(如新闻站点),建议每日甚至每小时更新Sitemap<ref name="wp-cron" /><ref name="baidu-update">[https://www.w3cschool.cn/baidu/baidu-lhqz25sx.html 链接提交-百度站长平台工具使用帮助 - W3CSchool]</ref>。
* '''自动化生成''':通过CMS插件或计划任务(cron job)实现Sitemap的自动生成,避免人工操作遗漏<ref name="wp-cron" />。
* '''监控状态''':定期登录搜索引擎的站长工具,查看Sitemap的提交状态、已索引URL数量以及任何错误报告。常见错误包括URL无法访问、格式错误、文件过大等<ref name="google-search-console" /><ref name="baidu-submit" />。
* '''清理无效URL''':确保Sitemap中不包含返回404(页面未找到)、301(永久重定向)或500([[服务器]]错误)的URL。及时移除已删除或不再需要索引的页面<ref name="yige-google" />。
 
== 参考文献 ==
<references />
[[分类:搜索引擎]]
[[分类:SEO]]