Recently I was going through the comments I received on my posts and I was shocked to see Spam all over it. These comments seem so genuine that it’s hard to identify that they are spam unless you do a little search over it. For example, I received a comment from a person(or rather a bot) which seemed so faithful that I couldn’t stop replying to it thanking for his interest over my blog. But when I ran a google search over it, the result page was full of such comment from different BlogEngine.Net sites.
Infact, I’m already using Akismet extension to protect against comment spam but it is clearly visible that it has severely failed to do so. Anyways, it will always be hard to protect your blogs from Comment Spam but what we can do is stop the spammer getting benefit from it.
Let’s first understand the motive behind comment spam. This has to to do with Google’s PageRank feature which, lets just say, works based on the links to different websites. For further information check this page and this page. So, what spammers want to do is increase page rank of their(or their clients’) PageRank by posting comments with links to their sites. So all we need to do is stop Google from indexing these links. And the best way to do it is by using the well known rel=”nofollow” attribute. So let me show you how to implement this feature on your blog.
First of all, it is necessary to know that how comments are shown at the bottom of your blog posts. Well for this, BlogEngine.Net uses a user control called CommentView.ascx that resides in your theme folder. Yes, the control is theme specific and so the c
hanges, we’ll need to make, will be theme specific. I’m just going to show you how to do it in Standard theme that comes out-of-the-box with BlogEngine.Net
Open CommentView.ascx in your favourite text editor(if your don’t have one, I suggest you to try Notepad++).
Look for a line similar to the one given below.
<%= Comment.Website != null ? "<a href=\"" + Comment.Website + "\" class=\"url fn\">" + Comment.Author + "</a>" : "<span class=\"fn\">" +Comment.Author + "</span>" %>
Now, just after class attribute, add rel=”nofollow”. The code should look something like this…
<%= Comment.Website != null ? "<a href=\"" + Comment.Website + "\" class=\"url fn\" rel=\"nofollow\">" + Comment.Author + "</a>" : "<span class=\"fn\">" +Comment.Author + "</span>" %>
This will tell Google not to index the links in the comments section and therefore, the links in the comments in the comment would remain futile.
Your comments and suggestions are always welcome :)