2014-10-17 25 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