Tuesday 5 March 2013

Hiding Links Inside Blogger Comments

Important: All scripts hosted on widcraft.googlecode.com don't work anymore because Google has blocked that SVN repository.

Good News!!! The percentage on SPAM has not increased since the last year. Great, you know how high was the percentage last year? 100%!!!

Spam everywhere on your blog comments? Well, it's hard to find and delete every single spam comment from your blog. Even in Blogger, spammers will always target your blog's comment form to spread spam. Blogger's inbuilt spam filter will stop almost every possible spam comments but this will not solve the problem.

Last year, I shared a nice way to reduce email spam. Prayag Verma came up with a simple jQuery powered hack that hides any clickable link and just displays its text.

Code:

<script src='https://widcraft.googlecode.com/svn/jquery.js'/>
<script> 

$('.comment-content a[rel$=nofollow]').replaceWith(function(){return ($(this).text());});

</script>

Add it just before the </body> tag in the Edit HTML. If you want to completely remove the links from the comments , then use this code instead:

<script src='https://widcraft.googlecode.com/svn/jquery.js'/>
<script> 

$('.comment-content a[rel$=nofollow]').hide());

</script>

This works for the Threaded Comments in Blogger, incase you want to make it work for the old Comments in Blogger , then the code is as follows:

<script src='https://widcraft.googlecode.com/svn/jquery.js'/>
<script> 

$('.comment-body p a[rel$=nofollow]').replaceWith(function(){return ($(this).text());});

</script>

Hope this will reduce some spam from your comments. Don't forget to leave your comments...
Important: Check our new website TricksPanda.com for WordPress tutorials, plugins and more.
 
Powered by Blogger.