如何在R-Bloggers上获取博客博客?

时间:2018-02-26 21:20:19

标签: r xml rss hugo blogdown

我使用blogdown生成blog但是当我尝试将其提交给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内容。如何让它保存所有内容?

2 个答案:

答案 0 :(得分:17)

在Hugo文档(https://gohugo.io/templates/rss/)中,它们提供了当前"附带的嵌入式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/中使用输出格式)并在{{1}中引用您的RSS (https://gohugo.io/templates/rss/),但将header.html更改为.Summary可以解决您的问题。

答案 1 :(得分:0)

这似乎对我有用...

在布局文件夹中创建一个名为标记的目录。因此,您应该具有以下文件夹结构:

<your_base_directory>/layouts/tags

(这不是主题目录中的layouts目录)。

然后创建一个新文件:

<your_base_directory>/layouts/tags/rss.xml

然后将this粘贴到新创建的rss.xml

相关问题