rss - 在 Octopress RSS 中仅显示标题

标签 rss jekyll octopress

我有一个基于 Octopress 的博客。它生成一个 RSS-feed,但该 feed 包含包含图像的整个页面(帖子)。

如何“缩小”它,使其仅包含页面(帖子)的标题?

Octopress:2.0
杰基尔:2.0.3

最佳答案

在 feed.xml 中,不要使用 post.content ,您可以使用post.excerpt .

两种解决方案:

1 - 使用 octopress 设置

添加<!-- more -->在您的帖子中标记 post.excerpt 之间的限制和post.contentcontent仍然包含两者。

2 - 使用 Jekyll 默认

删除此行 excerpt_separator: <!--more-->从你的配置文件。由于默认摘录分隔符是 "\n\n" (两行新行)摘录将自动创建。

替代解决方案

使用truncate过滤{{ post.content | truncate: 200 | expand_urls: site.url | cdata_escape }}

您会发现more information about excerpt in Jekyll documentation

关于rss - 在 Octopress RSS 中仅显示标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30741560/

相关文章:

javascript - 如何从 Javascript 生成的 HTML 表创建 RSS 提要

markdown - 我添加了一个 Markdown 文件,但我不想发布它

javascript - Google Feed API - 返回媒体 :thumbnail

ruby - 在 Windows 7 上运行 jekyll 服务器时出错

jekyll - 无法使用 Jekyll 生成任何内容

jekyll - 我可以使用 Jekyll 从文件夹结构生成导航吗?

html - 如何在我的 octopress 博客中添加新页面

javascript - 如何统计我的 Octopress 博客的浏览量?

Java ROME RSS 库和 RSS 描述字段中的 HTML 代码

rss - RSS 提要中的图像