forked from zklhp/hexo-generator-category-feed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.ejs
34 lines (34 loc) · 1.46 KB
/
atom.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
29
30
31
32
33
34
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><%-: config.title | cdata %></title>
<% if (config.subtitle){ %><subtitle><%-: config.subtitle | cdata %></subtitle><% } %>
<link href="<%- encodeURI(feed_url) %>" rel="self"/>
<link href="<%- encodeURI(config.url) %>/"/>
<updated><%= new Date().toISOString() %></updated>
<id><%- config.url %>/</id>
<% if (config.author){ %>
<author>
<name><%-: config.author | cdata %></name>
<% if (config.email){ %><email><%-: config.email | cdata %></email><% } %>
</author>
<% } %>
<generator uri="http://zespia.tw/hexo/">Hexo</generator>
<% posts.forEach(function(post){ %>
<entry>
<title><%-: post.title | cdata %></title>
<link href="<%- encodeURI(post.permalink) %>"/>
<id><%- post.permalink %></id>
<published><%= post.date.toDate().toISOString() %></published>
<updated><%= post.updated.toDate().toISOString() %></updated>
<content type="html"><%-: post.content | cdata %></content>
<summary type="html">
<% if (post.description){ %><%-: post.description | cdata %>
<% } else if (post.excerpt){ %><%-: post.excerpt | cdata %>
<% } else {%><%-: post.content.substring(0, 140) | cdata %><% } %>
</summary>
<% [].concat(post.tags.toArray(), post.categories.toArray()).forEach(function(category){ %>
<category term="<%= category.name %>" scheme="<%- encodeURI(category.permalink) %>"/>
<% }) %>
</entry>
<% }) %>
</feed>