2014-10-17 24 views
0

我在傑基爾如下的RSS模板:使用傑基爾變量中更換濾芯

--- 
layout: nil 
--- 
<?xml version="1.0" encoding="utf-8"?> 
<feed xmlns="http://www.w3.org/2005/Atom"> 
<title>{{ site.title }}</title> 
<link href="{{ site.url }}/feed.atom" rel="self"/> 
<link href="{{ site.url }}/"/> 
<updated>{{ site.time | date_to_xmlschema }}</updated> 
<id>{{ site.url }}/</id> 
<author> 
    <name>{{ site.author.name }}</name> 
    <email>{{ site.author.email }}</email> 
</author> 
{% for post in site.posts limit:20 %} 
<entry> 
    <title>{{ post.title }}</title> 
    <link href="{{ site.url }}{{ post.url }}"/> 
    <updated>{{ post.date | date_to_xmlschema }}</updated> 
    <id>{{ site.url }}{{ post.id }}</id> 
    <content type="html">{{ post.content | replace:'src="/assets','src="http://example.com/assets' | xml_escape }}</content> 
</entry> 
{% endfor %} 
</feed> 

現在,我想http://example.com(目前硬編碼)與{{ site.url }}變量代替。我嘗試了很多方法,但無法實現它。答案

回答

1

部分是這樣一個問題:

{{ post.content | replace:'src="/assets','src="http://example.com/assets' | xml_escape | replace: 'http://example.com', site.url }} 
+0

請重新閱讀我的問題。該網址目前是硬編碼的。我需要將它改爲一個變量。 – Ameer 2014-10-18 03:09:44

+0

謝謝你的回答,併爲反對錶示歉意。 – Ameer 2014-10-18 09:29:16

+0

沒問題@美女! – 2014-10-18 10:13:40