Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

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: [http://alanwsmith.com/feed.xml][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.*

-- hr

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 <<link|the template|https://github.com/coyled/coyled.com/blob/master/atom.xml>> in the feed.xml file and replace the various 'coyled.com' 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:

	<</images/aws-20120427--1620-01|img|caption: Problem Dates in Atom Feed>>

	The fix for this was to add:
		<published>{{ "{{ post.date | 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:
	<</images/aws-20120427--1622-01|img|caption: Problem Dates in Atom Feed>>

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.

-- hr

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

[feed]: http://alanwsmith.com/feed.xml

[jta]: http://coyled.com/2010/07/05/jekyll-templates-for-atom-rss/

[w3cv]: http://validator.w3.org/feed/

[jrss]: https://encrypted.google.com/search?q=jekyll+rss

[prop]: http://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared

[nnw]: http://netnewswireapp.com/

[atomspec]: https://tools.ietf.org/html/rfc4287

[localspec]: http://alanwsmith.com/atom-2005-v11.rnc