【发布时间】:2020-08-23 00:32:29
【问题描述】:
ReadTheDocs 为项目自动生成 robots.txt 和 sitemap.xml。每次我部署项目的新次要版本(例如4.1.10)时,我都会隐藏以前的次要版本(例如4.1.9)。 ReadTheDocs 将所有版本的条目添加到sitemap.xml,但隐藏版本也添加到robots.txt。结果是向 Google Search Console 提交站点地图,此时会导致“提交的 URL 被 robots.txt 阻止”错误,因为之前的站点地图条目现在被新生成的 robots.txt 阻止。
ReadTheDocs 为每个版本生成一个站点地图 URL,因此我们为 4.1.9 提供了这样的条目,例如:
<url>
<loc>https://pyngrok.readthedocs.io/en/4.1.9/</loc>
<lastmod>2020-08-12T18:57:47.140663+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>
当4.1.10被释放并且之前的小版本被隐藏时,新生成的robots.txt得到:
Disallow: /en/4.1.9/ # Hidden version
我相信这个 Disallow 是导致 Google 抓取工具抛出错误的原因。
实际上,我在sitemap.xml 中想要的只是latest、develop 和stable,我不太在意要抓取每个版本。但我能够配置的所有as I understand it from ReadTheDocs docs 是静态robots.txt。
我想要的是发布我自己的静态sitemap.xml,而不是使用自动生成的。有什么办法可以做到这一点?
【问题讨论】:
标签: robots.txt read-the-docs google-search-console xml-sitemap