Adding rss feed in Jekyll

Recently I wanted to add an rss feed to my Jekyll-based blog. Unfortunately there is no support for this. Quite strange…

I ended up with creating simple feed.xml to be processed with Jekyll. Once you create it, there’s no need of updating when posting.

layout: putsomerandomstringhere
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <title>put your blog's title here</title>
    <description>put your blog's description here</description>
    {% for post in site.posts %}
        <title>{{ post.title }}</title>
        <description>{{ post.content | xml_escape }}</description>
        <link>{{ post.url }}</link>
    {% endfor %}

Strange layout prevents from ignoring page by Jekyll, and xml_escape prepares post content to be displayed in rss feed.


comments powered by Disqus