Tesugen

My customizations of blosxom

I’ve made some small customizations of blosxom, to enable the “Wiki!” and “Google!” links you see below each story. To do this, I had to add the following lines of code. First, I want to say that I am not very familiar with Perl, so it’s probably possible to do this in a much more compact way (which seems to be a virtue in Perl (-:).

First you have to use URI::Escape; in order to be able to escape the URL’s for the “Google!” links. Then you have to insert the following line of code:

$fh->close; <br /> my $escaped_title = uri_escape($title); # NEW! <br /> my $story = ($content_type eq 'text/ ...


One thing the blosxom docs didn’t mention, was that you, besides having a head.html and foot.html, also can have a story.html. I had made some adjustments to the HTML at the end of the blosxom script, but customizing the entry in story.html feels much better. So, in your story.html insert the following to get a “Google!” link:

&lt;A HREF="http://google.com/search?q=$escaped_title"&gt;Google!&lt;/A&gt;


The “Wiki!” links works pretty much the same way, but escaping is different. For now, I just replace all spaces with ”_” and remove all colons. I guess I need to filter out more characters the Wiki doesn’t like, but this works for me so far. Then insert HTML like the above, but use $wiki_title and link to your Wiki URL.

my $wiki_title = $title; <br /> $wiki_title =~ s/ /_/g; <br /> $wiki_title =~ s/://g;


Another thing I needed to do was $url =~ s/included:\/\//http:\/\//g;, since all URL’s had “included” as protocol when I used SSI. I don’t know why, but this fix works. As for the filters, they aren’t blosxom customizations. I will get back to those later.

The above was posted to my personal weblog on May 2, 2002. My name is Peter Lindberg and I am a thirtysomething software developer and dad living in Stockholm, Sweden. Here, you’ll find posts in English and Swedish about whatever happens to interest me for the moment.

Posted around the same time:

The seven most recent posts:

  1. Tesugen Replaced (October 7)
  2. My Year of MacBook Troubles (May 16)
  3. Tesugen Turns Five (March 21)
  4. Gustaf Nordenskiöld om keramik kontra kläddesign (December 10, 2006)
  5. Se till att ha två buffertar för oförutsedda utgifter (October 30, 2006)
  6. Bra tips för den som vill börja fondspara (October 7, 2006)
  7. Light-Hearted Parenting Tips (September 16, 2006)
Bloggtoppen.se