April 04, 2003

static blogrolling

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}/blogroll.html.new

if [ $? -eq 0 ]; then
  mv ${WEBDIR}/blogroll.html.new ${WEBDIR}/blogroll.html
  echo "blogroll.sh 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.

06:34 PM | blogging | comments (2) | trackback (0)

older posts