Tuesday, 3 June 2014

Automatically Remove Spam Links In Blogger Comments

Posted by Pramod Sharma
For established bloggers, it is hectic and quite time consuming process to moderate comments on a blog. Having limited resources on BlogSpot platform doesn't allow it for detecting the spam comments automatically which makes it manual process for all BlogSpot users. 

For beginners I have previously shared about spam comments and process to remove them. But this way comments may not be easily moderate. Spam comments are always a part of blackhat SEO and hence include the process of link building
Remove Spam Links

Maximum time, whenever you come across spam comments, you would see links at the end or in between which is the sole purpose of spamming. So what if we remove that link from the comment? This way it will not cause the harm it could have been otherwise. 

We can easily do so and in this post I will be sharing the tutorial by which you would be automatically removing spam links from spam comments without any efforts from your side giving you much relief from spams and any moderation process.
.

How to Automatically Hide Spam Links In Blogger Comments?

What this script actually does is to remove links whenever the user led comments with spam link on your blog.Here are the steps:

  • Blogger Dashboard Click The Drop Down Menu in Your Blog > Choose Template > Then Edit Html > Now Proceed
  • Find the following piece of code in your blogs Html :


</body>



  •  Now Copy And Paste This Code Directly Above / Before </body>



<!--Stop Blog Comments -->
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script>
$('.comment-content a[rel$=nofollow]').replaceWith(function(){return ($(this).text());});
</script>
<!--Stop Blog Comments-->

All done.
Read:
Final words:
Although this script also have a disadvantage that it will remove the links from those comments which has no intention to spam and include necessary links in it. For example it could remove links from your comment in which you had referred a link to reply of somebody's comments. But this is not that much inconvenience as that of spam links.

I hope next time you would save your time and keep your comments useful and spam free. Any suggestions and queries are always welcome in the comments below.

2 comments:

  1. Very useful, thanks, i have one question though, are the links completely removed or they are just hidden and might appear again when i change the template
      Mycareerbase

    ReplyDelete
  2. Hi Isaac, although links will be completely removed but they will be appearing again when you change your template because the JavaScript you had in previous template would not be in your new template anymore.So you need to put code again in your template in order to remove links.

    ReplyDelete