Static Blogrolling

Annika Backstrom
in Meta, on 4 April 2003.

In the interest of more accessible and indexable Blogrolling, I use a combination of PHP, cron, and some scripting to avoid the more commonly seen JavaScript route. I thought I'd share with the Googlebot, who seems to be my most frequent visitor, second only to myself.

Here's the script:



/usr/bin/curl "${URL}?${ROLLID}" -s -o ${WEBDIR}/

if [ $? -eq 0 ]; then
    mv ${WEBDIR}/ ${WEBDIR}/blogroll.html
    echo " failed: $?" 1>&2

Cron runs this every fifteen minutes, so my blogroll is pretty up-to-date. Note that I don't replace blogroll.html right away. If curl can't run for whatever reason (or if the network is slow), it's going to create a text file that's blank, which is a Bad Thing. So, I create a temp file, and if all went well, I rename it so it becomes the include.