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

问题描述 投票:10回答:1

我使用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内容。如何让它保存所有内容?

r xml rss hugo blogdown
1个回答
17
投票

在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.htmlhttps://gohugo.io/templates/rss/)中引用你的RSS,但是将.Summary更改为.Content应该可以解决你的问题。

© www.soinside.com 2019 - 2024. All rights reserved.