Saturday, October 03, 2009

Blogspot ATOM in Feed-normalizer / Simple-RSS

Both Cragwag and Sybilline are using the excellent Feed-normalizer for parsing RSS and ATOM feeds, but there's been a niggling problem with the ATOM generated by Blogger / Blogspot in particular - the resulting links on each entry end up pointing to the comments, not the post itself.

So I just forked simple-rss at github and fixed this.

Turns out that simple-rss is just taking the first link tag that it comes across and using that as the link for a post, which in the case of Blogspot ATOM is the comments link.

On inspection of the ATOM RFC it says (section 4.2.7.2) :

atom:link elements MAY have a "rel" attribute that indicates the link relation type. If the "rel" attribute is not present, the link element MUST be interpreted as if the link relation type is "alternate".

Looking at the Blogspot ATOM, it looks like every element has a link rel="alternative" that points to the URL you would see if you navigated to the post from the blog homepage, so I've made it choose that link if it exists.

Github should build the gem automatically - but it's taking a long time to do it, so in the meantime, you can download it from http://github.com/aldavidson/simple-rss and build it locally:


gem uninstall simple-rss
cd (source root)
rake gem
cd pkg
gem install -l simple-rss


That should fix the problem

1 comment:

Julien said...

Thanks a lot for publishing your fix!

I'm using feed-normalizer on @montrealhackers and i'm glad to have that issue finally fixed.

Regards,
Julien