Home > Deeply Technical > Showing Google Reader Feeds on a WordPress Sidebar

Showing Google Reader Feeds on a WordPress Sidebar

November 17th, 2008

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.

The feed, with concatinated titles

The feed, with concatenated titles

The Problem:

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.

The Solution

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.

The Step-by-Step

  1. Get your Google Reader Feed URL (Settings -> Folders and Tags -> View Public Page -> Get the feed from your browser)
  2. Set up a Feedburner feed using the URL from step 1
  3. On the Feedburner feed, deactivate Browser Friendly and Smart Feed (under the Optimize tab)
  4. Still on the Feedburner feed, activate Convert Format using RSS 2.0.
  5. Note the URL of the feedburner feed
  6. Use that one to populate your RSS widget in WordPress

 

Bonus Points

  • 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/>
<span class=’reading-annot’>^gr=>annotation_content$</span></li>

  • 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.

 

Missing Pieces

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.

Deeply Technical , ,

  1. November 28th, 2008 at 17:52 | #1

    Thanks!It works!!

  2. December 4th, 2008 at 20:40 | #2

    Outstanding work – thanks so much.

  3. January 12th, 2009 at 08:27 | #3

    A very neat workaround.

  4. January 17th, 2009 at 21:35 | #4

    Thanks! Helped a lot.

  5. January 24th, 2009 at 19:58 | #5

    Thanks, I wanted to set this up on my new blog, and your instructions worked perfectly!

  6. January 25th, 2009 at 19:44 | #6

    One note, I realized the links and title’s weren’t showing up correctly when I used the template to display my comments in the widget. I fixed it by changing all the apostrophes(‘) to quotes(“) and it worked like a charm.

  7. Eliezer
    January 29th, 2009 at 15:59 | #7

    I just had a hiccup with this today. Without my making any changes to Reader, Feedburner, or my blog, the sidebar feed started to look funny. It was showing post titles and originating blogs (huh?) and not showing my comments. I started digging into the problem, but after checking feedburner to see if anything went wrong, the problem just went away. Hmm…

  8. February 6th, 2009 at 12:06 | #8

    I love my Google Reader and have tried a few ways to include some of my public feeds in wordpress, but have found a lot of frustration. I wasn’t able to get feeburner to fix things either.

    The only solution I have found that fully translates the Google RSS, complete with the links to original articles and all is to pass it through Yahoo Pipes, then Feed WordPress plugin.

    That also offers some interesting possibilities for combining new feeds, adding flickr feeds and even further filtering. Or just add the one feed and use the new Yahoo feed to bring into wordpress.

    In wordpress I like the FeedWordpress plugin.

    Wp-O-Matic killed my site, spiraling out of control! I had to call my hosting company and have them kill the process. In just a few minutes it posted hundreds of posts from a feed with 8 posts total!

    Or if you just want titles, find the Simplepie Plugin – Works great.

  9. February 20th, 2009 at 13:16 | #9

    Nice explanation.

    For those still struggling or looking for a solution, we just released a plug in a few days ago that makes it really easy to add Google Reader shared items to your blog and customize what it looks like. It even includes widget support.

    http://wordpress.org/extend/plugins/recommended-reading-google-reader-shared/

    Would love your feedback on how to improve!

  10. June 10th, 2009 at 02:23 | #10

    You post is very helpful to me and I

  11. February 9th, 2010 at 15:44 | #11

    @Jake
    I have your plugin working successfully here Jake
    http://www.thehuntingdynasty.com/the-hunter-blog/

    I think it’s great, to be honest: simple to configure. And I’m using a php call directly in the page file

  12. rene
    June 7th, 2011 at 13:20 | #12

    hi,
    i am totaly new in wordpress and i do not understand the last point:
    6. Use that one to populate your RSS widget in WordPress

    what exactly should i do?
    thanks a lot!

  13. Eliezer
    June 7th, 2011 at 13:27 | #13

    The URL noted in step 5 is the one to put in as the source URL for the RSS widget. (Exactly where that goes, I’ll tell you the truth, I don’t remember, and it’s not immediately obvious to me on a very quick look at my settings over here.)

  14. rene
    June 7th, 2011 at 13:48 | #14

    :) thanks anyway
    will try to be patient and find it ;)
    cheers

  1. December 3rd, 2008 at 18:30 | #1
  2. February 2nd, 2009 at 23:48 | #2
  3. February 13th, 2009 at 15:56 | #3