Skip to content
This repository was archived by the owner on Jan 27, 2018. It is now read-only.

Commit afec1ee

Browse files
Laxplusjade
authored andcommitted
add support for RSS feed.
add link tag in page header, to support subuscribe rss/atom feed in browsers.
1 parent 4d45997 commit afec1ee

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ JB :
7373
archive_path: /archive.html
7474
categories_path : /categories.html
7575
tags_path : /tags.html
76+
atom_path : /atom.xml
77+
rss_path : /rss.xml
7678

7779
# Settings for comments helper
7880
# Set 'provider' to the comment provider you want to use.

_includes/themes/twitter/default.html

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
2626
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
2727
-->
28+
29+
<!-- atom & rss feed -->
30+
<link href="{{ BASE_PATH }}{{ site.JB.atom_path }}" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed">
31+
<link href="{{ BASE_PATH }}{{ site.JB.rss_path }}" type="application/rss+xml" rel="alternate" title="Sitewide RSS Feed">
32+
2833
</head>
2934

3035
<body>

atom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title : Atom Feed
66
<feed xmlns="http://www.w3.org/2005/Atom">
77

88
<title>{{ site.title }}</title>
9-
<link href="{{ site.production_url }}/atom.xml" rel="self"/>
9+
<link href="{{ site.production_url }}/{{ site.atom_path }}" rel="self"/>
1010
<link href="{{ site.production_url }}"/>
1111
<updated>{{ site.time | date_to_xmlschema }}</updated>
1212
<id>{{ site.production_url }}</id>

rss.xml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
layout: nil
3+
title : RSS Feed
4+
---
5+
6+
<?xml version="1.0" encoding="UTF-8" ?>
7+
<rss version="2.0">
8+
<channel>
9+
<title>{{ site.title }}</title>
10+
<description>{{ site.title }} - {{ site.author.name }}</description>
11+
<link>{{ site.production_url }}{{ site.rss_path }}</link>
12+
<link>{{ site.production_url }}</link>
13+
<lastBuildDate>{{ site.time | date_to_xmlschema }}</lastBuildDate>
14+
<pubDate>{{ site.time | date_to_xmlschema }}</pubDate>
15+
<ttl>1800</ttl>
16+
17+
{% for post in site.posts %}
18+
<item>
19+
<title>{{ post.title }}</title>
20+
<description>{{ post.content | xml_escape }}</description>
21+
<link>{{ site.production_url }}{{ post.url }}</link>
22+
<guid>{{ site.production_url }}{{ post.id }}</guid>
23+
<pubDate>{{ post.date | date_to_xmlschema }}</pubDate>
24+
</item>
25+
{% endfor %}
26+
27+
</channel>
28+
</rss>

0 commit comments

Comments
 (0)