Showing Google Reader Feeds on a WordPress Sidebar
Google Reader has some great tagging and sharing features. You can easily get an Atom feed of those stories that you have tagged with a particular tag – this is a great way to keep a public ‘current reading’ list. It wasn’t as easy as I had thought it would be to get this feed up on my WordPress blog, but I found a way. Hopefully the below will be helpful to anyone trying to do the same.
WordPress uses the Magpie RSS parser to parse feeds. This is true for the built in RSS widget and also the advanced KBRSS widget. Magpie has some limitations that are highlighted by Google’s feeds. In particular Magpie has a nasty habit of taking multiple <link> tags and squishing them into one, and doing the same with multiple <title> tags. Very bad behavior for a parser. Without any additional treatment, WordPress digests Google Reader links like the picture at right.
I’ll cut out some of the wrong turns along the way. This post, from EconTech, solves a parallel problem and gave me the key to fixing this one. We need to scrub the feed before we send it over to WordPress. He used Feedburner to clean it up and translate it to RSS, than let WordPress and Magpie digests the RSS that Feedburner spits out.
- Get your Google Reader Feed URL (Settings -> Folders and Tags -> View Public Page -> Get the feed from your browser)
- Set up a Feedburner feed using the URL from step 1
- On the Feedburner feed, deactivate Browser Friendly and Smart Feed (under the Optimize tab)
- Still on the Feedburner feed, activate Convert Format using RSS 2.0.
- Note the URL of the feedburner feed
- Use that one to populate your RSS widget in WordPress
- I assume that the default WordPress RSS widget works, but I didn’t try it. Part of what I like about Google Reader is the ability to add notes to the items you share, and I wanted to make sure those got fed in. So I’m using the kbrss plugin. You can follow the instructions to set that guy up – it’s pretty straightforward. I use a template along these lines to get the fields I want:
<li><span class=’reading-date’>^pubdate[opts:date=F jS Y]$</span><br/>
<a class=’reading-link’ href=’^link$’ title=’^title$’>^title$</a><br/>
- If you get deeper into kbrss, you’ll probably want to use the ?kbrss=feed_url option to take a look at how WordPress reads your feed. On my setup, I had to encode my feed url before this option would work. Probably some sort of security issue. Here’s a string encoder.
What’s left out of this solution is those second and third links and titles that were in the original feed. In particularly, the title of the blog that the story originally came from doesn’t get carried through. If you want to take up the charge, that’s something that should be picked up in a more robust solution.