The Emerald’s blogs run on an install of WordPress MU. I wanted to pull the latest post on each blog into the homepage of the main site to drive traffic to ‘em. I obviously didn’t want to update the teases by hand — that would just be silly.
Bonus: this way I get to play with YQL. It’s pretty neat. YQL, in brief, lets me throw a WordPress RSS feed at it and it gracefully returns JSON data for me to play with.
Many of the YQL-jQuery examples use anonymous JSONP callback functions which break caching on YQL’s end because every request is different. I believe strongly in caching, so I defined static callback functions to standardize the GET requests being sent to Yahoo. I hope this means they can cache those queries.
The ability to use a SQL-like query language to pull RSS, get just the title and link properties, and limit to the more recent post is just awesome.
I’ve included the code below, but it’s running for real here.
The iframe in the homepage of dailyemerald.com grabs that page and boom. Done.
Feel free to use/enhance/maim/whatever the code. It’s not pretty, but it works. *fingerscrossed* Please let me know if you use it or make it better.