How To Automatically Hide Spam Links In Blogger Comments




| 9 comments

Spam Comments Computer Keyboard Stock Image
Comment spam is a major issue for all bloggers.We all love comments and they can be the life blood of a blog but spam can be hard to control.Even comments that look OK can contain spam links, especially on Blogger were when moderating comments you can not see if any of the text is a link.So in this post I have two ways to ensure your the comments on your blog will not contain spam links.Not only will it remove the links from any future comments but it will also remove all links from past comments.

We have two options :

CSS - First a small piece of CSS that will completely remove links left in comments.With the CSS the anchor text that make the link (the clickable words) will be completely removed the rest of the comment will remain.

jQuery - Second we have a small piece of jQuery script that will leave the anchor text that make the link (the clickable words) but they will no longer be a link or clickable.

Cool Ehh ? I had used the CSS for some time (Yes spammers ye have been wasting your time) but have now switched to the jQuery.Check out the video tutorial to see more on how each works then It's your choice on how you want to go.The codes needed are below the video.


Video Tutorial



Use CSS To Completely Remove Links And Anchor Text

Step 1. - In Your (New Design) Blogger Dashboard Click The Drop Down Menu For Your Blog > Choose Customize > Advanced > Add Css, as shown in the video below.


Step 2. Copy and Paste the following code into the Css Section then click Apply To Blog.

.comment-content a {
display: none;
}

Use jQuery To Remove Links But Leave The Anchor Text

Step 1. In Your (New Design) Blogger Dashboard Click The Drop Down Menu For Your Blog > Choose Template > Then Edit Html > Now Proceed as shown in the video Below :

Step 2. Find the following piece of code in your blogs Html : (Click Ctrl and F for a search bar to help find the code - How To Find Code In Blogger Template Template)
</body>

Step 3. Now Copy And Paste This Code Directly Above / Before </body>

Note - The line in yellow is the main jQuery script if you previously added this to your blog do not add it.

<!--Stop Blog Comments http://www.spiceupyourblog.com -->
<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 http://www.spiceupyourblog.com -->

And that's your lot, no more sleepless nights worrying if people have left dodgey links on your blog.

Drop your comments and questions below.

AuthorAuthor - Paul Crowe is the owner and main author of Spice Up Your Blog.Paul lives in Ireland, has been blogging since 2006 and writing Spice Up Your Blog since 2009.You can find him in the usual social networks.


Join over 5000 Subscribers! Please sign up to receive Updates.

SUYB has its Focus on Quality. If we post Crap, you can unsubscribe.

No Spam and No Garbage! - Use RSS, Twitter & Facebook as an Alternative


If You Enjoyed This Post Please Take 5 Seconds To Share It.

9 comments:

  1. This is great and the video makes it so easy my new favorite website!!

    ReplyDelete
  2. Thank you for this easy tutorial, spam comments have become a real problem for me recently.

    ReplyDelete
  3. Hi Paul, I'm fairly sure there is a dodgy link on my blog (when I view it on my phone I get taken to an app advert) but when I search for
    smaller than / slash / body /greater than
    it cant find it?

    ReplyDelete
  4. this is a great post.spammer very disturb me.thanks

    ReplyDelete
  5. thanks for tutorial.,, spammer really disturb.

    ReplyDelete
  6. Hi, Paul. I know and am sure that links hidden using CSS can only be applied to human eyes, but not Google. What about the second method, does google reads links hidden using jquery? Thanks :)

    ReplyDelete
  7. Thank you! that piece of code really helps!

    ReplyDelete
  8. That is useful for me actually, thank now I can avoid the blogger spam using the css that you share

    ReplyDelete
  9. i like it this thank you ^^ no spam again in my blog

    ReplyDelete



Important - If you ask a question make sure you tick the "Notify Me" box below the comment form to be notified of follow up comments and replies.


Hire Us