【问题标题】:make xml rss feed out of static pages in jekyll从 jekyll 中的静态页面中制作 xml RSS 提要
【发布时间】:2015-10-12 23:00:30
【问题描述】:

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>

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

是否可以评估这些变量?

【问题讨论】:

    标签: rss jekyll


    【解决方案1】:

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

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

    【讨论】:

    • 如果我没看错的话,前面的事情是存在的。
    • 所以,你的存储库 url 可以帮助调试。
    猜你喜欢
    • 2013-10-19
    • 1970-01-01
    • 1970-01-01
    • 2020-02-05
    • 2017-06-22
    • 2018-10-07
    • 1970-01-01
    • 2013-04-02
    • 1970-01-01
    相关资源
    最近更新 更多