Hide plugin and date-based URLs

The hide plugin allows you to conceal certain posts and/or categories from the standard blosxom index pages – this works for either path or date based URLs. A side effect of this is that if you are using date-based links like me – http://example.com/YYYY/MM/DD/filename – then the posts won’t show up when you visit their permalinks – they’ll only display when referenced with a URL like http://example.com/path/to/filename.flavour.

A solution is to add quick test to the start subroutine in the hide plugin that checks to see whether blosxom knows about any date-based path information:

sub start {
  $blosxom::path_info_yr and return 0;
  ...

As I don’t want posts in about/ to display in the monthly archives, I used the $path_info_da variable, but you could just as easily use $path_info_yr or $path_info_mo instead to allow the posts to display on less specific date-based index pages.

Stripping out <script> tags from RSS feeds

It’s good practice not to include <script> tags inside your RSS feeds, and feedvalidator.org will react if you include them, so here’s a plugin that will do this for you.

By default, the plugin will attempt to strip <script> tags from the $body of your posts when $blosxom::flavour equals “rss”. This is configurable, of course.

Note that the plugin is not designed as a security precaution and so the regular expression used to try and find the tags isn’t particularly sophisticated. It is case-insensitive but expects to find the actual tags themselves to be unbroken by white space or line breaks, however the contents of the tags can be arranged in any way you please.

Auto escaping HTML in RSS with blosxom

Out of the box, blosxom comes with simple HTML and RSS formats built in. In order to get the RSS 0.91 feed set-up correctly, blosxom escapes HTML tags during the story generation phase where is finds an XML content-type (specifically: $content_type =~ m{\Wxml$}).

This feature is fine until you start experimenting with your RSS feeds when it can become a bug. For example, if you decide to provide the full text for each story in a feed enclosed in a CDATA section, you don’t want this escaping to take place. So I recommend that you move the escaping section from blosxom itself and place it into a plugin where you can then call it if you need it.

The escaping code is lines 378-384 in the standard blosxom 2.0 script. Just for fun I’ve made a patch, but it’s probably simpler to just open a text editor and do it by hand. Here’s a simple plugin that allows you to control whether or not the code is called during the story generation phase.

Getting in touch

If you need or want to contact me, the best way is probably by email. Please note that unsolicited commercial email (spam) is not welcome; stuff like this ends up going directly to the bit bucket, so please don’t waste your time or my bandwidth.

In an effort to reduce the amount of spam I receive, I use javascript to generate the email address links in the list below. If your web browser doesn’t display these links, you’ll just have to type in the email address yourself, sorry.

Here it is: sam -at- sgp -dot- me -dot- uk.

I have a PGP key (download). Id: 40e74c48, fingerprint: 3fd9 91a2 f12b bfa2 ed31 2fa4 453c a714 40e7 4c48. If for some reason you’d rather not download it from this site, try a keyserver like pgp.mit.edu.