Skip to content

Commit

Permalink
add support for RSS feed.
Browse files Browse the repository at this point in the history
add link tag in page header, to support subuscribe rss/atom feed in browsers.
  • Loading branch information
Lax authored and plusjade committed Feb 24, 2013
1 parent 4d45997 commit afec1ee
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _config.yml
Expand Up @@ -73,6 +73,8 @@ JB :
archive_path: /archive.html
categories_path : /categories.html
tags_path : /tags.html
atom_path : /atom.xml
rss_path : /rss.xml

# Settings for comments helper
# Set 'provider' to the comment provider you want to use.
Expand Down
5 changes: 5 additions & 0 deletions _includes/themes/twitter/default.html
Expand Up @@ -25,6 +25,11 @@
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
-->

<!-- atom & rss feed -->
<link href="{{ BASE_PATH }}{{ site.JB.atom_path }}" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed">
<link href="{{ BASE_PATH }}{{ site.JB.rss_path }}" type="application/rss+xml" rel="alternate" title="Sitewide RSS Feed">

</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion atom.xml
Expand Up @@ -6,7 +6,7 @@ title : Atom Feed
<feed xmlns="http://www.w3.org/2005/Atom">

<title>{{ site.title }}</title>
<link href="{{ site.production_url }}/atom.xml" rel="self"/>
<link href="{{ site.production_url }}/{{ site.atom_path }}" rel="self"/>
<link href="{{ site.production_url }}"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ site.production_url }}</id>
Expand Down
28 changes: 28 additions & 0 deletions rss.xml
@@ -0,0 +1,28 @@
---
layout: nil
title : RSS Feed
---

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>{{ site.title }}</title>
<description>{{ site.title }} - {{ site.author.name }}</description>
<link>{{ site.production_url }}{{ site.rss_path }}</link>
<link>{{ site.production_url }}</link>
<lastBuildDate>{{ site.time | date_to_xmlschema }}</lastBuildDate>
<pubDate>{{ site.time | date_to_xmlschema }}</pubDate>
<ttl>1800</ttl>

{% for post in site.posts %}
<item>
<title>{{ post.title }}</title>
<description>{{ post.content | xml_escape }}</description>
<link>{{ site.production_url }}{{ post.url }}</link>
<guid>{{ site.production_url }}{{ post.id }}</guid>
<pubDate>{{ post.date | date_to_xmlschema }}</pubDate>
</item>
{% endfor %}

</channel>
</rss>

0 comments on commit afec1ee

Please sign in to comment.