Mike Schaeffer's Blog

Articles with tag: blog
August 28, 2006

Updating Posts

One of the 'downsides' of the way Blosxom is implemented is that is relies on a post file's modification date to assign a date to the post. This makes editing files a little tricky: editing files on a Unix box updates the modification date and therefore promotes the post to the top of the blog. I don't know if there's a better way to do this, but I've written a little script that edits a file, making sure to restore the previous modification date.

The implementation is pretty simple: it uses mktemp to create a temporary file and touch -r to copy the modification dates from the post file to the temporary file and back. Be sure to modify the #! line to point to your installation of bash, should you decide to use this script. A nice generalization of this script would have it prompt for a description of the update and add the text to the post.

#!/usr/local/bin/bash

if [ $# -ne 1 ]
then
  echo
  echo "This script expects a command line argument: the
  echo "name of the post to edit."
  exit 1
fi

DATE_MARKER=`mktemp /tmp/date_marker.XXXXXX` || exit 1

touch -r $1 ${DATE_MARKER}

${EDITOR} $1

touch -r ${DATE_MARKER} $1

rm ${DATE_MARKER}
June 22, 2006

Blosxom Difficulties

My blog setup requires that I log in via ssh to my webserver to use a text editor to edit articles in raw HTML. This is the downside of using barebones blog software. On the flip side, it'd at least be pretty easy to add a (private) article submission form. All it would have to do is present a list of subdirectories in the blosxom hierarchy, and allow content from a text box to be deposited into a named file with a specified timestamp (which can be set with touch). Step 2: allow these files to be edited in a text box.

February 22, 2005

Blosxom, Annotated

Frank Hecker, in an effort to teach himself more about Blosxom has done a cool thing. He has taken the source for Blosxom and annotated it with extra comments to describe what it's doing each step of the way. I don't know if I'll ever use the knowledge to hack Blosxom, but it's still good reading.

February 9, 2005

./blosxom.cgi: 444 lines, 16674 characters.

I've spent a little time doing some things to tweak Bloxsom so that it fits better into my website. So far, I've:

  • Changed the html flavour to refer to my CSS file and use it correctly.
  • Set up a simple hierarchy of post topics.
  • Gotten static rendering working (as a test, it's not in use now.)

None of this is all that earth shattering, but it was all trivial to do in Bloxsom. For a one-file, 16K Perl script, Bloxsom brings a lot to the table.

Next on the adgenda is getting a web form set up for posting and hopefully editing blog posts, and then setting up a web-based way to upload images into the blog. My current workflow for posting to the blog involves two levels of nested SSH logins and the use of vi. shudder.

Older Articles...