【发布时间】:2013-05-08 06:42:05
【问题描述】:
假设我的根目录中有一个 robots.txt 文件 http://domain.com/robots.txt,该文件在子文件夹中指定了一个站点地图,该文件有一个指向站点地图索引的声明:
robots.txt
Sitemap: http://domain.com/sub/sitemap_index.xml
还假设站点地图索引指向与子目录相同的sitemap.xml:
sitemap_index.xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://domain.com/sub/sitemap-1.xml</loc>
</sitemap>
</sitemapindex>
在站点地图规范中,明确指出站点地图只能指定当前文件夹或子文件夹中的 URL。但是,这在我上面描述的场景中会发生变化吗?我问的原因是我知道 robots.txt 文件可以指向托管在完全不同的域上的站点地图。如果这是可能的,那么子文件夹中的站点地图(但从根目录中的 robots.txt 指向)可以指定根目录和所有子文件夹中的 URL。
有人知道吗?
【问题讨论】:
-
我测试了一下,似乎 Googlebot 不接受站点地图:robots.txt 中位于子目录中的行。 'blocked URLs' 部分有一个 robots.txt 测试器,如果它可以解析它,它还会列出 Sitemap 行。
标签: html sitemap robots.txt