It’s relatively easy to get the feed for your Jekyll site running on FeedBurner.

Firstly, you need to choose a subdirectory to host your feed on. Calling it feed seems to be a fairly popular choice, so I decided to follow the crowd. Create a folder called feed at the base of your Jekyll site, and create an index.xml file inside with the following contents (obviously swapping the references to Recursive for your own site details) :

---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Recursive</title>
 <link href="http://www.daveperrett.com/feed/" rel="self"/>
 <link href="http://www.daveperrett.com/"/>
 <updated>{{ site.time | date_to_xmlschema }}</updated>
 <id>http://www.daveperrett.com/</id>
 <author>
   <name>Recursive</name>
   <email>mail@recursive-design.com</email>
 </author>

 {% for post in site.posts %}
 <entry>
   <title>{{ post.title }}</title>
   <link href="http://www.daveperrett.com{{ post.url }}"/>
   <updated>{{ post.date | date_to_xmlschema }}</updated>
   <id>http://www.daveperrett.com{{ post.id }}</id>
   <content type="html">{{ post.content | xml_escape }}</content>
 </entry>
 {% endfor %}

</feed>

When you generate your site, this should create a feed/index.xml file in your generated ‘’_site’’ folder. Now if you go to http://your-site.com/feed/index.xml, you should see your generated RSS feed.

That trailing index.xml is a little ugly, so the next step is to get your feed to appear when users access the /feed/ folder directly. I serve everything with nginx, where we can use the index directive to set the index file for a folder :

location /feed {
    index index.xml;
}

You can achieve the same result in Apache using the DirectoryIndex directive :

DirectoryIndex index.xml

Restart your webserver and you should be able to see your feed at http://your-site.com/feed/ without the trailing index.xml.

Now that our feed is up and running, we want to add it to FeedBurner. Add a new feed at FeedBurner pointing to your http://your-site.com/feed/ directory :

Add Feed

After clicking next a few times, you should get a FeedBurner URL for your feed :

Added Feed

Now things get a little more complicated - we want to redirect everyone to our new feed URL, but we still want FeedBurner to be able to see the original feed from our site (we don’t want to redirect FeedBurner back to themselves). We can achieve this with a little nginx trickery, building on our previous nginx change :

location /feed {
    index index.xml;

    # Feedburner redirect
    set $feed_redirect 'http://feeds.feedburner.com/your-site/WnKh';
    if ($http_user_agent ~* "FeedBurner") {
        set $feed_redirect '';
    }
    if ($http_user_agent ~* "FeedValidator") {
        set $feed_redirect '';
    }
    if ($feed_redirect ~* "^(.+)$") {
        rewrite ^ $feed_redirect? permanent;
    }
}

What this does is allow anyone with FeedBurner or FeedValidator in their user agent to access our original feed, but redirects everyone else to the new FeedBurner feed. It’s a good idea to check that your feed is still working after this step at feedvalidator.org.

Once you’ve confirmed that your feed is still valid, you’re done!