make xml rss在jekyll中输出静态页面

时间:2015-10-12 23:00:31

标签: rss jekyll

Jekyll附带的默认feed.xml就是这样,然后骑行 帖子:

---
layout: null
---
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
    <title>{{ site.title | xml_escape }}</title>
    <description>{{ site.description | xml_escape }}</description>
    <link>{{ site.url }}{{ site.baseurl }}/</link>
    <atom:link href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml"/>
    <pubDate>{{ site.time | date_to_rfc822 }}</pubDate>
    <lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>
    {% for post in site.posts limit:10 %}
    <item>
        <title>{{ post.title | xml_escape }}</title>
        <description>{{ post.content | xml_escape }}</description>
        <pubDate>{{ post.date | date_to_rfc822 }}</pubDate>
        <link>{{ post.url | prepend: site.baseurl | prepend: site.url }}</link>
        <guid isPermaLink="true">{{ post.url | prepend: site.baseurl | prepend: site.url }}</guid>
        {% for tag in post.tags %}
        <category>{{ tag | xml_escape }}</category>
        {% endfor %}
        {% for cat in post.categories %}
        <category>{{ cat | xml_escape }}</category>
        {% endfor %}
    </item>
    {% endfor %}
</channel>
</rss>

我想要的是循环浏览静态页面,但如果我交换 post page的所有实例,代替page.content我得到的{{ page.title }} 未呈现的液体标签,因此我的页面内容包含在xml Feed中 .square字面意思而不是该页面的评估标题。

是否有可能对这些变量进行评估?

1 个答案:

答案 0 :(得分:0)

Jekyll只呈现一个前面的页面。在这种情况下,它必须是:

---
layout: null
---
... code here