Adding RSS to Jekyll blog

Posted on Apr 19, 2014

One of the caveats of using “vanilla” Jekyll (vs using other tools that are built on top of Jekyll such as Octopress or JekyllBootstrap) is that there is some plumbing to do to add things that are “expected” on a blog engine, such as an RSS feed. An RSS feed comes handy for people that want to follow your site and consolidate everything into an RSS reader (such as feedly).

Adding an RSS feed is as simple as to generate an XML file that contains a lists of your posts. You could generate that by hand or use one of the available templates online. I opted for the last option (why re-invent the wheel?) and used the templates from snaptortoise’s jekyll-rss-feeds. Download a template from there (I used feed.xml) and put it wherever you want in your site (/feed.xml for example). You also need to add some configuration variables in your _config.yml:

1
2
3
name: Sebastian's Blog
description: Sebastian occasionally writes about things.
url: http://sebasr.com

If you want (you should!) make it possible for browser and other software automatically find your RSS feed you should add a meta tag inside your page’s header (as described by the RSS advisory board). Here is what I put in my default.html file:

1
<link rel="alternate" type="application/rss+xml" title="{{ site.name }}" href="{{ site.url }}/feed.xml">

And that should be it!