Skip to content

Commit b12b8d7

Browse files
committed
format rss.xml & atom.xml
1 parent cd93dda commit b12b8d7

File tree

2 files changed

+45
-34
lines changed

2 files changed

+45
-34
lines changed

atom.xml

+21-17
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,27 @@ title : {{ page.title | xml_escape }}
55
<?xml version="1.0" encoding="utf-8"?>
66
<feed xmlns="http://www.w3.org/2005/Atom">
77

8-
<title>{{ site.title }}</title>
9-
<link href="{{ site.url }}/{{ site.atom_path }}" rel="self"/>
10-
<link href="{{ site.url }}"/>
11-
<updated>{{ site.time | date_to_xmlschema }}</updated>
12-
<id>{{ site.url }}</id>
13-
<author>
14-
<name>{{ site.author.name }}</name>
15-
</author>
8+
<title>{{ site.title }}</title>
9+
<image>
10+
<url>{{ site.assets_path }}/images/favicon.png</url>
11+
</image>
12+
<link href="{{ site.url }}/{{ site.atom_path }}" rel="self"/>
13+
<link href="{{ site.url }}"/>
14+
<updated>{{ site.time | date_to_xmlschema }}</updated>
15+
<id>{{ site.url }}</id>
16+
<author>
17+
<name>{{ site.author.name }}</name>
18+
</author>
1619

17-
{% for post in site.posts %}
18-
<entry>
19-
<title>{{ post.title | xml_escape }}</title>
20-
<link href="{{ site.url }}{{ post.url }}"/>
21-
<updated>{{ post.date | date_to_xmlschema }}</updated>
22-
<id>{{ site.url }}{{ post.id }}</id>
23-
<content type="html">{{ post.content | strip_html | truncate:300 | xml_escape }}</content>
24-
</entry>
25-
{% endfor %}
20+
{% for post in site.posts %}
21+
<entry>
22+
<title><![CDATA[{{ post.title | xml_escape }}]]></title>
23+
<link href="{{ site.url }}{{ post.url }}"/>
24+
<id>{{ site.url }}{{ post.id }}</id>
25+
<content type="html">{{ post.content | strip_html | truncate:300 | xml_escape }}</content>
26+
<category><![CDATA[{{ post.category }}]]></category>
27+
<updated>{{ post.date | date_to_xmlschema }}</updated>
28+
</entry>
29+
{% endfor %}
2630

2731
</feed>

rss.xml

+24-17
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,29 @@ title: {{ page.title | xml_escscape }}
55

66
<?xml version="1.0" encoding="UTF-8"?>
77
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
8-
<channel>
9-
<title>{{ site.title }}</title>
10-
<description>{{ site.description }}</description>
11-
<link>{{ site.url }}{{ site.rss_path }}</link>
12-
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>
13-
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate>
14-
<ttl>1800</ttl>
8+
<channel>
9+
<title><![CDATA[{{ site.title }}]]></title>
10+
<image>
11+
<url>{{ site.assets_path }}/images/favicon.png</url>
12+
<title><![CDATA[{{ site.title }}]]></title>
13+
<link>{{ site.url }}</link>
14+
</image>
15+
<description><![CDATA[{{ site.description }}]]></description>
16+
<link>{{ site.url }}</link>
17+
<author>{{ site.author.name }}</author>
18+
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>
19+
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate>
20+
<ttl>1800</ttl>
1521

16-
{% for post in site.posts limit:10 %}
17-
<item>
18-
<title><![CDATA[{{ post.title }}]]></title>
19-
<description>{{ post.content | xml_escape }}</description>
20-
<link>{{ site.url }}{{ post.url }}</link>
21-
<guid>{{ site.url }}{{ post.id }}</guid>
22-
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate>
23-
</item>
24-
{% endfor %}
25-
</channel>
22+
{% for post in site.posts limit:10 %}
23+
<item>
24+
<title><![CDATA[{{ post.title }}]]></title>
25+
<description>{{ post.content | xml_escape }}</description>
26+
<link>{{ site.url }}{{ post.url }}</link>
27+
<guid>{{ site.url }}{{ post.id }}</guid>
28+
<category><![CDATA[{{ post.category }}]]></category>
29+
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate>
30+
</item>
31+
{% endfor %}
32+
</channel>
2633
</rss>

0 commit comments

Comments
 (0)