This repository has been archived by the owner on Apr 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
atom.ejs
34 lines (34 loc) · 1.44 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><%= posts[0].updated.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://hexo.io/">Hexo</generator>
<% posts.forEach(function(post){ %>
<entry>
<title><%-: post.title | cdata %></title>
<link href="<%- encodeURI(post.permalink) %>"/>
<id><%- post.permalink %></id>
<published><%= post.date.toISOString() %></published>
<updated><%= post.updated.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>