We're now on LinkedIn: For news and resources from Google Search on making your site discoverable,
follow us on LinkedIn.
使用站点地图索引文件管理站点地图
如果您的站点地图超过了大小上限,则需要将较大的站点地图拆分成多个站点地图,让每个新站点地图都小于大小上限。拆分站点地图后,您可以使用站点地图索引文件这种方式同时提交多个站点地图。
站点地图索引最佳实践
XML 格式的站点地图索引文件与 XML 格式的站点地图文件非常相似,前者由站点地图协议定义。
这意味着,所有站点地图要求同样适用于站点地图索引文件。
引用的站点地图必须与站点地图索引文件在同一个网站上托管。如果您设置了跨网站提交功能,则可免除此要求。
站点地图索引文件中引用的站点地图必须与站点地图索引文件位于同一目录中,或者位于网站层次结构中的更低一级目录中。例如,如果站点地图索引文件位于 https://example.com/public/sitemap_index.xml
,它只能包含位于相同或更深目录中的站点地图,如 https://example.com/public/shared/...
。
您最多可为 Search Console 账号中的每个网站提交 500 个站点地图索引文件。
站点地图索引示例
以下示例是一个 XML 格式的站点地图索引,其中列出了两个站点地图:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap1.xml.gz</loc>
<lastmod>2024-08-15</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap2.xml.gz</loc>
<lastmod>2022-06-05</lastmod>
</sitemap>
</sitemapindex>
站点地图索引引用
站点地图索引标记由与通用站点地图相同的命名空间定义:
http://www.sitemaps.org/schemas/sitemap/0.9
为确保 Google 能够使用您的站点地图索引,您必须使用以下必需的标记:
必需的标记 |
sitemapindex |
XML 树的根标记。它包含所有其他标记。 |
sitemap |
文件中列出的每个站点地图的父标记。它是 sitemapindex 标记的唯一直接子级。
|
loc |
站点地图的位置(网址)。它是 sitemap 标记的子级。一个站点地图索引文件最多可以包含 50,000 个 loc 标记。
|
此外,以下可选标记可能有助于 Google 安排何时抓取您的站点地图:
可选标记 |
lastmod |
标识修改相应站点地图文件的时间。它可以是 sitemap 标记的子级。lastmod 标记的值必须采用 W3C 日期时间格式。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-25。
[null,null,["最后更新时间 (UTC):2025-02-25。"],[[["A sitemap index file is used to submit multiple sitemaps to search engines, especially when a single sitemap exceeds the size limit."],["Sitemaps listed within the index file must reside on the same site (unless cross-site submission is configured) and be in the same directory or a lower subdirectory."],["You can submit up to 500 sitemap index files for each website registered in your Search Console account."],["Sitemap index files have a specific XML format, similar to sitemaps, and include required tags like `sitemapindex`, `sitemap`, and `loc`."],["Optional tags like `lastmod` can be added to indicate the last modification time of the sitemap file, aiding in crawl scheduling by search engines."]]],["When a sitemap exceeds size limits, split it into smaller sitemaps. Use a sitemap index file to manage and submit multiple sitemaps simultaneously. The sitemap index's XML format mirrors that of a sitemap and follows the Sitemap Protocol. Referenced sitemaps must be on the same site or lower in the directory, or use cross-site submission. A sitemap index can contain up to 50,000 `loc` tags, with `sitemapindex`, `sitemap`, and `loc` being required. Up to 500 sitemap indexes can be submitted per site.\n"]]