Now with Feed Adding an RSS-Atom Feed to Jekyll

TODO: Figure out why this isn't working in MDX

I've added a news reader feed to the site. You can grab it here: [][feed]

*Note: If you're not a techie, and terms like "Syndication Format", "Relax NG Schema" and "Feed Validation" aren't familiar to you, you can safely skip the rest of this post.*


The jekyll blogging engine (which I'm using for this site) doesn't come with the built-in RSS or Atom feeds. Since I'm a huge fan of using feeds via [NetNewsWire][nnw], setting one up was high on my TODO list. The first result Google returned for "[jekyll rss][jrss]" is a post by a guy name Dave Coyle called "[Jekyll Templates for Atom, RSS][jta]". It's exactly what I was looking for.

There are two feed options to choose from: Atom 1.0 and RSS 2.0. Most of the [propaganda][prop] I've seen suggest that Atom is the way to go. I doubt it will really make a difference for me, but that's what I picked. 

The steps I used to add the feed were:

1. Create a new 'feed.xml' file at the root of the jekyll source directory. 

2. Copy the contents of [the template]( in the feed.xml file and replace the various '' specific items with my stuff.

3. Run jekyll. 

Everything looked pretty good, but I wanted to actually validate the output. Unfortunately, I was doing this work at night after a long day in the office. I completely missed the fact that Dave confirmed these were valid and even linked to the [W3C Feed Validation Service][w3cv]. Since I missed that, I went down a rabbit hole with the [Atom Syndication Format][atomspec]. The spec includes a Relax NG Schema, but it's split across multiple "pages". I pulled the parts out and made my own copy. Sure enough, the feed output validated just fine. (Incidentally, if you want your own, already assembled copy of the schema, I've [posted it here][localspec]. I'd advise just using the W3C service though.)

After the initial validation, I noticed a few things about the feed that I wanted to change. Specifically:

1. The feed contained all the posts on the site. I just wanted the last 10 or so to keep the number sane. This was accomplished by changing:

		{{ "{% for post in site.posts " }}%}


		{{ "{% for post in site.posts limit:10 " }}%}
2. In NetNewsWire, instead of each post displaying the date it was made, they had the time when the feed file itself was generated. Like so:

	![Problem Dates in Atom Feed](/images/aws-20120427--1620-01)

	The fix for this was to add:
		<published>{{ "{{ | date_to_xmlschema " }}}}</published>
	to each entry. (I've forked the original on github and am issuing a pull request to add this update to the original.) With that change in place, the dates show up properly:
	![Problem Dates in Atom Feed](/images/aws-20120427--1622-01)

3. I wanted to add a copyright notice to the feed. This was done by simply the following under the root feed node:

		<rights>Copyright © 2012, Alan W. Smith</rights>

With those changes, I ran one final validation. Everything check out and is displaying the way I like. So, the feed is now live and will update as I push new posts. 

Enjoy. If you're into that kind of thing.


*Update: My pull request was merged so the "published" node is now in the source template.*