HackingUniversity - Hacks . Tricks . How-To's

29 January 2013

Automatically Remove Links from your Blogger Comments

stop-spamWell commenting is a powerful way to build quality backlinks, but people or I say spammers are using this same trick to spam on quality blogs and get their page rank and traffic right to their blog, so no matter how much quality blog do you own this thing can happen and will surely happen. Well now the one way easy way to get rid of these stuff is too use the Disqus or Intense Debate commenting system that allows you to configure on how you wanna show the links posted in your comments.

But what can you do when the thing comes for blogger's default commenting system, well then you do not have much options to configure it out, but we have an awesome script trick that will allow you to remove links from your comments or even transform those links into simple lines of text.

Remove Links in New Blogger Commenting System

Well if you are using new blogger commenting system, then below provided are two codes that can be using to remove and to transform your links into text.

  1. Transforming Links into Text – well if you just need to transform links into text and do not want to remove them up, then copy the below code and paste it above the </body> tag in your blogger's Edit HTML, if you already have jQuery installed remove the red line.

    <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'/>
    <script>$('.comment-content a[rel$=nofollow]').replaceWith(function(){return ($(this).text());});</script>

  2. Removing Links – well if you do not want to transform links into text but just wanna remove them out then paste the below code above </body> tag.

    <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'/>
    <script>$('.comment-content a[rel$=nofollow]').hide());</script>

Remove Links in Old Blogger Commenting System

Well if you are still using the old blogger commenting system and the above code is not working for you website then you might have to use the below code to get this stuff working. So just copy the below code & paste it above the </body> tag.

<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'/>
<script>$('.comment-body p a[rel$=nofollow]').replaceWith(function(){return ($(this).text());});</script>

So that's it, this will help you in controlling some spam on your website that is caused due to spammers and commenting system in combined, well do comment if you find any problem using this script.