如何在 R-Bloggers 上获取我的 blogdown 博客? [英] How do I get my blogdown blog on R-Bloggers?

查看:39
本文介绍了如何在 R-Bloggers 上获取我的 blogdown 博客?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 blogdown 生成了我的博客,但是当我尝试提交它时对于 R-Bloggers,它不被接受,因为 my feed 返回以下错误:

I generate my blog using blogdown, but when I have tried to submit it to R-Bloggers it is not accepted because my feed returns the following error:

此 XML 文档无效,可能是由于字符无效.
XML 错误:第 6 行第 35 列未声明的实体错误

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

显然,我网站的 feed 不包含完整的 RSS 内容.如何让它保存所有内容?

Apparently the feed for my website does not contain the full RSS content. How do I get it to hold all the content?

推荐答案

在 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.

In the Hugo documentation (https://gohugo.io/templates/rss/), they provide the embedded RSS xml file that currently "ships with" Hugo. According to the docs, a section’s RSS will be rendered at /SECTION/index.xml (e.g., http://spf13.com/project/index.xml). So for your posts, it would be http://spf13.com/post/index.xml.

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

The key line in the built-in RSS xml file is this one:

{{ .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/

From this discussion (https://discourse.gohugo.io/t/full-text-rss-feed/8368/2), it looks like you want to change what goes in the description tags from .Summary to .Content. Here is an example blog post where the author implemented this change: https://randomgeekery.org/2017/09/15/full-content-hugo-feeds/

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

So you would change that one line in the Hugo RSS xml to:

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

完整的 rss.xml 文件应位于您的 layouts/ 文件夹中,其中一行已更改.

The full rss.xml file should live in your layouts/ folder, with that one line changed.

看起来您确实可以测试其他选项,例如在 config.toml 文件 (https://github.com/gcushen/hugo-academic/issues/346; https://gohugo.io/templates/output-formats/) 并在 header.html (https://gohugo.io/templates/rss/),但改变了.Summary.Content 应该可以解决您的问题.

It does look like there are other options you could test, like working with output formats in your config.toml file (https://github.com/gcushen/hugo-academic/issues/346; https://gohugo.io/templates/output-formats/) and referencing your RSS in your header.html (https://gohugo.io/templates/rss/), but changing .Summary to .Content should address your issue.

这篇关于如何在 R-Bloggers 上获取我的 blogdown 博客?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆