forked from zklhp/hexo-generator-category-feed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrss2.ejs
28 lines (28 loc) · 1.24 KB
/
rss2.ejs
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
<?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 | cdata %></title>
<link><%- encodeURI(config.url) %>/</link>
<atom:link href="<%- encodeURI(feed_url) %>" rel="self" type="application/rss+xml"/>
<description><%-: config.description | cdata %></description>
<pubDate><%= new Date().toUTCString() %></pubDate>
<generator>http://zespia.tw/hexo/</generator>
<% posts.forEach(function(post){ %>
<item>
<title><%-: post.title | cdata %></title>
<link><%- encodeURI(post.permalink) %></link>
<guid><%- encodeURI(post.permalink) %></guid>
<pubDate><%= post.date.toDate().toUTCString() %></pubDate>
<description>
<% if (post.description){ %><%-: post.description | cdata %>
<% } else if (post.excerpt){ %><%-: post.excerpt | cdata %>
<% } else {%><%-: post.content.substring(0, 140) | cdata %><% } %>
</description>
<content:encoded><%-: post.content | cdata %></content:encoded>
<% if (post.comments){ %><comments><%- encodeURI(post.permalink) %>#disqus_comments</comments><% } %>
</item>
<% }) %>
</channel>
</rss>