← Back to Archives

A Simple Method for Inserting a Bloglines Blogroll

system

Have I mentioned that I like Bloglines, lately? One cool feature is that you can export the list of what you read as a blogroll. Bloglines offers a JavaScript and an HTML blogroll that you can embed in your blog.

Naturally, I choose to use the HTML version of their blogrolling service. I generally like to minimize the use of JavaScript; I like static mark-up where something more complicated is overkill. However, updating your HTML blogroll is a tad cubersome (go to bloglines, find the blogroll "tip", export your blogroll in HTML, open the main blog page on the server, paste in my (rather large) blogroll text into an emacs -nw terminal and save the file).

Simple geeky solution: To quote Wendy during the heavy computing on election day, "wget is your friend."

Log in to your blog's server in a terminal window. Create an alias in the .cshrc file in your root directory:

alias getblogroll 'wget -O blogroll.html "http://rpc.bloglines.com/blogroll?html=1\&id=userid"'

Geeky details: The above should be all on one line. The entire command is surrounded in single quotes ('). The URL that wget is after is surrounded in double quotes ("). The ampersand (&) must be escaped with a backslash (\) to get a slash-ampersand (\&).

Change userid in the above to your bloglines user ID. Then, source your .cshrc file (source .cshrc).

Now, the command, getblogroll will save your HTML Bloglines blogroll as the file, blogroll.html, in your root directory.

Now, all you have to do is log in to your server, run the getblogroll command, open your main blog page, insert blogroll.html and save the file.

UPDATE [2004-11-27 13:51:13]: As Matthew notes in the comments below, this can be automated entirely! (I didn't even know you had a blog, Matthew... instantly added to the blogroll!)

While I'm not going to use cron jobs, I've modified my getblogroll alias to save the blogroll.html file in the directory of my blog's index file. Now, as Matthew noted, I can replace all the opening of the index file, inserting and saving with a single PHP command:

<?php require( dirname(__FILE__).'/blogroll.html'); ?>

Now, I can just run my getblogroll command whenever I update my blogroll (like I just had to for Matthew's blog!).