【问题标题】:jekyll-sitemap and robots.txt get wrapped in html unexpectedly when generating jekyll sitejekyll-sitemap 和 robots.txt 在生成 jekyll 站点时意外被包裹在 html 中
【发布时间】:2021-05-04 20:33:10
【问题描述】:

我的 sitemap.xml 和 robots.txt 由 jekyll-sitemap 生成,由于某种原因被包裹在 html 中,这使得它们不符合要求。

我正在使用 jekyll-sitemap 插件,经过验证,它是最新版本 (https://github.com/jekyll/jekyll-sitemap),并尝试了许多其他方法,主要是通过前端和 conf 设置 layout: none 的各种方法。

如果我创建一个随机文本或 xml 文件,它们最终不会被包裹在 html 中。

我还尝试禁用所有插件和默认布局设置以及compress 布局,但找不到原因。

有人遇到过这样的问题吗?有什么想法可以调试吗?

站点地图.xml:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<?xml version="1.0" encoding="UTF-8"?><html><body>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
...
actual sitemap goes here
...
</body></html>

[编辑] 当我创建一个随机文件 with frontmatter 时,它确实被包装了,即使我添加了layout: none

【问题讨论】:

    标签: html xml jekyll sitemap jekyll-extensions


    【解决方案1】:

    我发现这与 jekyll-external-links 插件 (https://github.com/riboseinc/jekyll-external-links) 一起发生。在 Gemfile 中停用 jekyll-external-links 时,jekyll-sitemap 会生成 robots.txt 和 sitemap.xml 文件而不会出错。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-20
      • 1970-01-01
      • 2016-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多