Not content to merely show bolded links when the people on my blogroll have recently updated, I rewrote the code for my blogroll (near the bottom of my sidebar) to display the most recent entry from each blog.
While the code is ugly and highly specialized for my use, here is the general idea:
I created a PHP script that uses the get_linkobjectsbyname()
function to retrieve my blogroll from WordPress. Then, I use MagpieRSS to retrieve a cached feed for each of the links that has the link_rss
field set. I then take the newest entry from the feed, and stick it in an array with the rest of the get_linkobjectsbyname()
data. I then do some magic on the date, using either the date of the latest entry as given in the RSS feed, or (if that’s not available), the link_updated
field from the blogroll (which is gotten from a weblogs.com ping cache). Then, I sort by most recent update, and then display the output.
Well, that’s what I did at first. But even though MagpieRSS uses cached versions of feeds when it can, if you’re the unlucky guy who loads the page right when the feeds expire, you’re looking at a 16 second load time while it downloads fresh copies. So I wrapped all that code above into a function that forces an update of the feeds, and then writes a plain text file with the output. I have a cron job do that once every 15 minutes. Now all I have to do is include the text file that it writes.
This has actually cut down on page generation time, because my blogroll isn’t being generated dynamically with each page view.
Watcher says
Wow… sounds like it was a lot of work, but it sure is cool! 🙂
Ben says
Hi!
I’ve been looking for something like this in the form of a plugin. I don’t suppose you are going to build a downloadable plugin with these features? No?
Nice site!
Cheers
Ben