Wed, 03 Nov 2010

rel="nofollow" in Blosxom

I added rel="nofollow" support to the Blosxom writeback plugin. I use Doug Alcorn's version that supports a blacklist and emails me when a new comment/trackback is posted.

Only one small change was required. I simply modified the writeback plugin to prepend all href attributes with rel="nofollow".

--- writeback.orig      2005-01-20 10:59:23.000000000 -0800
+++ writeback   2005-01-20 11:31:00.000000000 -0800
@@ -233,6 +233,7 @@

         $writeback =~ s/\$writeback::(\w+)/$param{$1}/ge;
         $writeback =~ s!mailto:([^\s<]+)!<a href="mailto:$1">$1</a>!g;
+        $writeback =~ s!\bhref\b!rel="nofollow" href!ig;
         $writebacks .= $writeback;
         $count++;
       }

Updated: changed regex to match word boundaries around href.

tech | Permanent Link

The state is that great fiction by which everyone tries to live at the expense of everyone else. - Frederic Bastiat