As we know, BlogSpot comment system is integrated with its default comment system that easily lets a commentator leave spam comments like promoting links, writing abusing words and much more. However, Blogger blogs give you the freedom to review the comments before they appear on your blogs.

Check out: How to Get Missing Comment Thread Work in Blogger

Blogger Spam comment protection

There are several reasons you want to ban a user from commenting on your blogger blogs, and one of the reason is to prevent the blogs from spam commentators who frequently send the comments that are considered unethical, rude, contains slander or promotional links which are not good enough to be displayed. To avoid these things occur in future, you need to add a simple jQuery code to your blogger template that will permanently put a spam commenter on the blacklist.

Pay Attention: How to Add Multiple Set Column to Blogger Posts

Spammers engage in this activity in the hope that they can improve their search engine rankings. A few of them carry these tasks because they are not aware of the disadvantages of spam commenting.

Recommended: jQuery Tabs and Accordion for BlogSpot Blogs

To permanently ban a user from commenting on your blog, you have to find his Blogger Profile URL to stop the spammers from accessing your comment form.  If you are among those bloggers, who do not have any idea how to tackle the spam commentators, then you are lucky here.

Banning Spam Commentator With jQuery

  1. Go to Blogger > Theme > Edit HTML 
  2. Add the jQuery code just above the </ body>
  3. <script type='text/javascript'>
    //<![CDATA[
    var spamlist=[
     'http://www.blogger.com/profile/xxxxxxxxxx', /* Commentators URL */
     'http://blog_name.blogspot.com/', /* Commentators blog URL */
    ];
    for(var v=0; v<spamlist.length; v=v+1){
     $("a[href='"+spamlist[v]+"']").each(function(){
     $(this).closest(".comment-block").find(".comment-content")
     .replaceWith("<div class='comment-content' style='color:red'>You have been banned!</div>"),
         $(this).replaceWith("<span style='color:red'>BANNED USER!</span>");
     })
    }
    //]]>
    </script>

    If the above code does not work for your template, you can try this one:

    <script type='text/javascript'>
    //<![CDATA[
    var spamlist=[
     'http://www.blogger.com/profile/xxxxxxxxxx', /* Commentators URL */
     'http://blog_name.blogspot.com/', /* Commentators blog URL */
    ];
    for(var v=0; v<spamlist.length; v=v+1){
     $("a[href='"+spamlist[v]+"']").each(function(){
     $(this).closest(".comment_inner").find(".comment_body")
     .replaceWith("<div class='.comment_body' style='color:red'>You have been banned!</div>"),
         $(this).replaceWith("<span style='color:red'>BANNED USER!</span>");
     })
    }
    //]]>
    </script>
  4. Click Save Theme

Banning Spam Commentator With Conditional Tag

  1. Go to Blogger > Theme > Edit HTML 
  2. Search for the following piece of code inside your theme editor
  3. <b:loop values='data:post.comments' var='comment'>
  4. Add the given conditional tag right below it
  5. <!--Banned-->
    <b:if cond='data:comment.authorUrl != &quot;http://www.blogger.com/profile/12345678910&quot;'>
    <!--Banned-->
  6. Now locate the </b: loop> and paste the following code just above it
  7. <!--Banned-->
    </b:if>
    <!--Banned-->
  8. Finally, click Save Theme and you are on the go

Before you save your theme, kindly replace the blue text with spammer's blogger URL.

SEMrush
Discover How to Gain Your Blog Traffic By 209%

Get Free Access

Recommended For You

2 comments: