2015-10-12 84 views
-1

默认feed.xml附带杰基尔送出静态网页是这样的,并通过 帖子循环:使XML RSS在杰基尔

--- 
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我得到 未着色液的标签,所以在XML进我的网页内容包含 {{ page.title }}字面上,而不是用于该页面的评价称号。

能评估这些变量吗?

回答

0

Jekyll只渲染前端的页面。在这种情况下,它必须是:

--- 
layout: null 
--- 
... code here 
+0

如果我看得很清楚,那个前置物品是存在的。 – branquito

+0

因此,您的存储库url可以帮助调试。 –