Comments now moderated
There's many other things I would have rather done with my free time tonight, but I had to finally do something about the blog spammers. I've hacked Movable Type's comment system to allow me to moderate comments.
I'm a professional perl hacker these days and thought I'd find a way to wire in Spam Assassin. Before starting I checked Google and found a much more simple solution: Edith Frost - Movable Type comments moderation.
All I had to do was comment out six lines in lib/MT/App/Comments.pm...
# $app->rebuild_indexes( Blog => $blog ) # or return $app->error($app->translate( # "Rebuild failed: [_1]", $app->errstr)); # $app->rebuild_entry( Entry => $entry ) # or return $app->error($app->translate( # "Rebuild failed: [_1]", $app->errstr));
You can't use the comments popup window anymore if you want to do this. I don't think so anyway. So I changed all the links on the index, date-based and category templates to point towards the comments section on the individual archive.
This cool trick just disables the automatic rebuilding of the indexes and entry. That keeps the comments off of the web until I manually rebuild my site. The comments are actually saved, just not published into the indexes nor appended to the entry. Editing the index and date-based archive templates to change the comment links is important. Left at the default, those popups point to the mt-comment.cgi which will happily display the not-yet-approved comments thereby defeating the point. Like Edith, I changed them to link to the entry archive.
The last trick is to tell the search engines to ignore the cgis:
document-root/robots.txt User-agent: * Disallow: /dobbse-cgi-bin/
Hopefully that will deny the spammers whatever link juice they think they can get from my site.
Update: I took a further measure of adding the following lines to the view method in Comments.pm:
sub view { return <<END_HTML; <html> <head><title>Blank</title></head> <body><h1>Blank</h1><p>This space intentionally left blank.</p></body> </html> END_HTML
Now even the mt-comments.cgi won't display comments -- they'll only show up on the individual archives which I control through manual updates.