Friday, January 24, 2020

How To Block Spam Comment Bots Inwards Blogger

Spam Comments tin crusade a existent problem if they are non prevented. To block spam comments, bloggers accept strict actions past times bespeak people to register, come inwards a captcha or respond a random query before leaving a comment. However, these spam prevention techniques acquire inwards hard for your daily visitors to comment because re-entering a weird captcha every fourth dimension yous brand a comment is a existent pain. Majority of Spam comment is made past times bots, which are designed to locomote out spammy comments on blogs as well as websites. Today inwards this article, nosotros volition present yous how to block spam comment bots inwards Blogger.


How Comment Spam Bots Work?

Blogger (service) is a used past times millions of blogs as well as websites. Therefore, all these websites uses the same Blogger commenting system unless they are using a third-party commenting system. This means, it makes it a lot easier for spam bots to honour blogs as well as postal service spam comments.

Some spam bots are smart plenty to create sum captcha as well as flexible plenty to respond dissimilar questions to fool the website's spam prevention system. This means, the best way to tackle spam bots is to completely block them from commenting on your website.


Method#1: Blocking Spam Bots inwards Blogger Using b:if Condition

In the begin method, nosotros volition block bots using b: if condition. Therefore, to ban a user from commenting on your site, yous receive got to honour his Blogger Profile URL as well as using b: if status halt him from accessing comment form. This volition blacklist a specific user's Blogger profile as well as he volition no longer hold upward able to brand or run into whatever comments on your site.
  1. To honour a user's Blogger Profile URL, acquire to your comment department as well as left click on the names of the comment posters.

  2. Now listing of options volition hold upward appear, from the listing pick out "Copy link address" equally it is shown inwards the screenshot below:
  3. After copying the profile URL, acquire to Blogger >> Template >> Edit HTML >> Search for </body> as well as only below it glue the next code:

  4. <b:if cond='data:comment.authorUrl!= &quot;https://www.blogger.com/profile/XXXXXXXXXX"' >
    <script>
     $(".comment-form").replaceWith("<p style=" color: #111; text-align: center; border: 1px company #d2d2d2; padding: 13px; font-size: 15px; ">You are Banned from Commenting on this site</p>");
    </script>
    </b:if>

  5. Now inwards the higher upward code, replace https://www.blogger.com/profile/XXXXXXXXXX with the Blogger profile URL yous copied earlier. Keep inwards heed this volition ban solely ane user to ban to a greater extent than users yous receive got to glue the higher upward code ane time again inwards your template but amongst dissimilar profile URL.

  6. Once everything is done, relieve the template. Take a await at the screenshot below to the results:

Method#2: Blocking Spam bots inwards Blogger amongst jQuery:

In the instant method, nosotros volition block bots using jQuery.
  1. Go to Blogger >> Template >> Edit HTML >> search for the ending </body> tag as well as correct higher upward it glue the next jQuery code:

  2. <script type='text/javascript'>
        //<![CDATA[
        //Block Spam Comment Bots inwards Blogger
        //Black List Blogger Profiles
        var spamlist = [
            'https://www.blogger.com/profile/XXX', //First Ban User
            'https://www.blogger.com/profile/XXX', //Second Ban User
            'https://www.blogger.com/profile/XXX' //Third Ban User
        ];


        for (var v = 0; v < spamlist.length; v = v + 1) {
            $("a[href='" + spamlist[v] + "']").each(function() {
                $(this).closest(".comment-block").find(".comment-actions, .datetime, .comment-replybox-thread, .comment-block")
                    .replaceWith("");
                $(this).closest(".comment-block").find(".comment-content")
                    .replaceWith("<div class='comment-content' style='color:red'>This user's comment has been removed!</div>");
                $(this).replaceWith("<span style='color:red'>BANNED USER!</span>");
            })
        }
        //]]>
    </script>

  3. Now inwards the higher upward code, supercede https://www.blogger.com/profile/XXX with the Blogger profile URL that yous would similar to ban. You tin ban unlimited users past times adding profile links inwards the higher upward codes.

  4. Once everything is done, press "Save Template". Take a await at the screenshot below to the results:
We promise this tutorial has helped yous inwards learning how to block spam comments bots inwards blogger. Let us know what exercise yous retrieve virtually this plugin inwards the comments below.

No comments:

Post a Comment