forked from hexojs/hexo-generator-feed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rss2.xml
35 lines (35 loc) · 1.4 KB
/
rss2.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>{{ config.title }}</title>
<link>{{ url | uriencode }}</link>
<atom:link href="{{ feed_url | uriencode }}" rel="self" type="application/rss+xml"/>
{% if config.feed.hub %}<atom:link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %}
<description>{{ config.description }}</description>
<pubDate>{{ posts.first().updated.toDate().toUTCString() }}</pubDate>
<generator>http://hexo.io/</generator>
{% for post in posts.toArray() %}
<item>
<title>{{ post.title }}</title>
<link>{{ (url + post.path) | uriencode }}</link>
<guid>{{ (url + post.path) | uriencode }}</guid>
<pubDate>{{ post.date.toDate().toUTCString() }}</pubDate>
<description>
{% if post.description %}
{{ post.description }}
{% elif post.excerpt %}
{{ post.excerpt }}
{% elif post.content %}
{{ post.content.substring(0, 140) }}
{% endif %}
</description>
{% if config.feed.content and post.content %}
<content:encoded><![CDATA[{{ post.content | safe }}]]></content:encoded>
{% endif %}
{% if post.comments %}<comments>{{ (url + post.path) | uriencode }}#disqus_thread</comments>{% endif %}
</item>
{% endfor %}
</channel>
</rss>