gpt4 book ai didi

r - 我如何在 R-Bloggers 上获取我的 blogdown 博客?

转载 作者:数据小太阳 更新时间:2023-10-29 01:39:58 24 4
gpt4 key购买 nike

我生成我的 blog使用 blogdown,但是当我试图将它提交给 R-Bloggers 时,它不被接受,因为 my feed返回以下错误:

This XML document is invalid, likely due to invalid characters.
XML error: Undeclared entity error at line 6, column 35

显然是 feed因为我的网站不包含完整的 RSS 内容。如何让它容纳所有内容?

最佳答案

在 Hugo 文档 ( https://gohugo.io/templates/rss/ ) 中,他们提供了当前“随附”Hugo 的嵌入式 RSS xml 文件。根据文档,一个部分的 RSS 将呈现在/SECTION/index.xml (例如 http://spf13.com/project/index.xml )。因此,对于您的帖子,它将是 http://spf13.com/post/index.xml .

内置RSS xml文件中的关键行是这一行:

<description>{{ .Summary | html }}</description>

从这个讨论 ( https://discourse.gohugo.io/t/full-text-rss-feed/8368/2 ) 来看,您似乎想要更改来自 .Summary 的描述标签中的内容。至 .Content .这是作者实现此更改的示例博客文章:https://randomgeekery.org/2017/09/15/full-content-hugo-feeds/

因此,您可以将 Hugo RSS xml 中的这一行更改为:

<description>{{ .Content | html }}</description>

完整的 rss.xml 文件应该在您的 layouts/ 中文件夹,更改了一行。

看起来确实还有其他选项可以测试,比如在 config.toml 中使用输出格式文件 ( https://github.com/gcushen/hugo-academic/issues/346 ; https://gohugo.io/templates/output-formats/ ) 并在 header.html 中引用您的 RSS ( https://gohugo.io/templates/rss/ ), 但改变 .Summary.Content应该可以解决您的问题。

关于r - 我如何在 R-Bloggers 上获取我的 blogdown 博客?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48997278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com