Sitemap.xml:修订间差异
TeodoroSeccombe(留言 | 贡献) 小 创建页面,内容为“。” |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
{| class="infobox" style="border:1px solid #ccc; background:#f8f9fa; width:24em; float:right; margin:0 0 1em 1em; border-spacing:5px;" | |||
! colspan="2" style="text-align:center;" |'''Sitemap.xml''' | |||
|- | |||
|中文名 | |||
|站点地图 | |||
|- | |||
|英文名 | |||
|Sitemap | |||
|- | |||
|协议版本 | |||
|0.9(sitemaps.org) | |||
|- | |||
|首发时间 | |||
|2005年6月 | |||
|- | |||
|首发机构 | |||
|Google | |||
|- | |||
|标准制定机构 | |||
|Google、Yahoo、Microsoft(联合) | |||
|- | |||
|文件扩展名 | |||
|.xml、.txt | |||
|- | |||
|格式类型 | |||
|XML / 纯文本 | |||
|- | |||
|标准网站 | |||
|www.sitemaps.org | |||
|} | |||
'''Sitemap.xml'''(全称:Sitemaps Protocol,中文常译为“站点地图协议”)是一种用于告知搜索引擎网站上可供抓取的网页地址列表的开放协议标准。网站管理员可将网站中的网页 [[URL]] 制作成标准化的 [[Sitemap]] 文件,以指引搜索引擎爬虫(Crawler 或 Spider)快速、全面地抓取或更新网站内容<ref name="baidu-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!|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.xml 文件作为 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)格式以及 Sitemap 索引(Sitemap Index)格式<ref name="ziyuan-baidu" />。XML 格式是应用最为广泛的标准格式,文件采用 UTF-8 编码,根节点为 ,并声明命名空间为 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 条目包含以下子元素: | |||
* :页面的完整 URL(含协议,必需)。 | |||
* :页面最后修改日期(可选,格式为 W3C Datetime)。 | |||
* :页面可能发生更改的频率(可选,有效值:always、hourly、daily、weekly、monthly、yearly、never)<ref name="baidu-format-detail">[https://ziyuan.baidu.com/wiki/44 百度Sitemap提交工具 - 格式说明]</ref>。 | |||
* :该页面在站内的相对优先级(可选,范围 0.0 至 1.0)<ref name="baidu-format-detail" />。 | |||
实际使用中,Google 官方文档已明确表示 <changefreq> 和 <priority> 两个标签在多数情况下被忽略,仅有 <lastmod> 在数据准确时被参考<ref name="seo-best-practices" />。 | |||
=== 技术限制 === | |||
根据 W3C 标准和主流搜索引擎的规范,单个 Sitemap 文件最多可包含 50,000 个 URL,未压缩体积不得超过 50 MB(或 10 MB,视搜索引擎而定)<ref name="developer-baidu">[https://developer.baidu.com/article/detail.html?id=5780853 网站地图生成技术解析 - 百度开发者中心]</ref><ref name="baidu-sitemap" />。URL 长度限制为 2,048 个字符<ref name="developer-baidu" />。对于超过限制的超大型网站,可使用 Sitemap 索引文件将多个 [[Sitemap]] 文件聚合提交<ref name="baidu-sitemap" />。此外,Sitemap 文件可采用 gzip 格式压缩以节省带宽<ref name="baidu-sitemap" />。 | |||
=== 纯文本格式 === | |||
除 XML 格式外,网站管理员还可以提供纯文本文件作为 Sitemap,文件中每行包含一个网址。该文件同样需遵循容量限制,且必须使用 UTF-8 或 GBK 编码<ref name="baidu-sitemap" />。URL 必须是完整路径(含 http:// 或 <nowiki>https://),文件中不得包含网址列表以外的任何信息</nowiki><ref name="baidu-sitemap" />。 | |||
== 与搜索引擎的交互 == | |||
Sitemap.xml 文件通常放置在网站的根目录下,路径为 /sitemap.xml<ref name="seo-best-practices" />。网站管理员可通过两种方式向搜索引擎提交 Sitemap: | |||
* 直接在搜索引擎的站长工具或资源平台(如 Google Search Console、百度资源平台)中提交 Sitemap 文件的 URL。 | |||
* 在网站根目录的 [[robots.txt]] 文件中添加 "Sitemap: http://example.com/sitemap.xml" 指令,搜索引擎爬虫将自动发现该文件<ref name="auto-discovery" /><ref name="robots-relation">[https://seo.yiguotech.com/archives/xml-sitemap-best-practices XML Sitemap 最佳实践:与 robots.txt 的关系]</ref>。 | |||
Sitemap 与 robots.txt 的关系可概括为:[[robots.txt]] 告诉爬虫"哪些地方不要去",而 Sitemap 告诉爬虫"哪些地方值得去",两者互补,互不冲突<ref name="seo-best-practices" />。需要注意的是,Sitemap 是建议而非命令,搜索引擎可以选择不抓取 Sitemap 中列出的 [[URL]];同时,Sitemap 仅加速 URL 的发现,并不直接参与页面排名计算,也不保证页面一定会被索引<ref name="seo-best-practices" />。 | |||
== 专业扩展 == | |||
Sitemap 协议在标准 XML 格式之外还支持针对特定内容类型的扩展,包括 Google 新闻 Sitemap 扩展、图片 Sitemap 扩展、视频 Sitemap 扩展以及移动 Sitemap 扩展<ref name="golang-sitemap">[https://pkg.go.dev/github.com/shuLhan/go-xml/sitemap Sitemap Package - Go Packages]</ref><ref name="www-sitemap-ext">[https://ftp.twaren.net/Unix/CPAN/authors/id/D/DA/DAVECROSS/WWW-Sitemap-XML-0.01/readme WWW::Sitemap::XML - Perl Module for Sitemap Extensions]</ref>。这些扩展通过在标准 {{tag|url}} 元素内部或外部添加特定命名空间的标签,为不同类型的网页提供更精细的元数据描述,帮助搜索引擎更准确地理解和索引富媒体内容。 | |||
== 参考文献 == | |||
<references /> | |||
[[分类:SEO]] | |||
[[分类:搜索引擎]] | |||