Dealing with comment spam is probably the biggest headache for most bloggers - the comment will have a word like "Cool" or "Interesting" and then a URL pointing to some online pharmacy story selling prescription drugs.
While WordPress has the excellent Akismet anti-spam filter that catches majority of comment spam, Google provides simple word CAPTCHAs and email based comment moderation for Blogger blogs. They also add a rel=nofollow for all links left in the visitor comments section and therefore deny any Google Juice to the linked website.
Even with these spam prevention measures in place, the problem is far from over. So how do you reduce the menace ? Just turn off comments, not for the entire blog but just for old blog posts.
Why ? Well, if you look at pending comments in your moderation queue that require approval, you'll see a pattern - the blog posts that are more popular in search engines are the biggest target of comment spam.
Blog comment spammers rarely target fresh posts that you have recently published because spammers discover their targets (your blog posts) via search engines and fresh posts are less likely to rank high in search results.
Now how do you disable comments in Blogger for old posts because unlike WordPress, there are now AutoShutOff and Comment Timeout plugins for blogger? The answer is simple - use Javascript.
<script type="text/javascript" language="javascript1.2">
var shutoffperiod = "2" // Turn Off Period (in months)
var str = "<$BlogItemPermalinkURL$>";var year = str.split("/")[3];
var month = str.split("/")[4];
var d = new Date();var diff = (d.getFullYear() - year)*12 + d.getMonth() + 1 - month;
if (diff <= shutoffperiod) {
document.write('<a href="http://www.blogger.com/comment.g?');
document.write('blogID=1234&postID=<$BlogItemNumber$>">Comment</a>');
} // Replace 1234 with your Blog ID
</script>
All you have to do is replace your Post a Comment blog in the blogger template with the above code. It computes the date of the blog post from the permalink and depending on the age of the blog post, the "Post a Comment" link will be added to your blog post.
Remember to replace 1234 with your Blog ID. The comment posting link for visitors is hidden by default for blog posts that older than 2 months. You can modify the default setting by changing the value of shutoffperiod variable in the script.
Related: Add Visitor Comments Policy in Blogger
Reader Comments
Hi Amit,
Nice trick but the problem is any user with little web tool tricks can bypass this restriction(Firefox firebug can remove any part of the web page code). Server side code trick may do much better protection.
Written on 21/8/07 7:44 AM
Hi Amit. I am the Founder of Intense Debate, and we have built a comment system replacement with a comprehensive set of features including voting, threading, reputation, comment stats, and more moderation tools.
If you would like to take a look let me know. josh at intensedebate dot com
Written on 21/8/07 9:33 AM
Partha is right. Google should seriously implement some serious spam combating techniques here on Blogger.
Maybe, some smart commenting thing like Digg, which turns off the catchpa after few dozen legitimate comments.
Written on 21/8/07 9:49 AM
I think switching off comments is not a ight option..
image verification does the trick and wont allow much spam .. if your blog is popular....
still if somebody posts a lot of spam messages, javascript to hide spam by a particular user is a better option... rather then switching the whole thing off
Written on 22/8/07 9:48 PM
...All you have to do is replace your Post a Comment blog in the blogger template
Sorry. Cannot find 'Post a Comment blog' in the template or anywhre else. Please be more specific
Written on 28/8/07 1:33 PM