nat*_*ood 15 xml rss r hugo blogdown
我使用了生成我的博客,blogdown但是当我尝试将其提交给R-Bloggers时,我不接受它,因为我的Feed返回以下错误:
This XML document is invalid, likely due to invalid characters.
XML error: Undeclared entity error at line 6, column 35
Run Code Online (Sandbox Code Playgroud)
显然,我网站的Feed不包含完整的RSS内容.如何让它保存所有内容?
小智 18
在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(https://gohugo.io/templates/rss/)中引用您的RSS ,但更改.Summary为.Content应解决您的问题.