Adding Basic Captcha Protection on your Shopify Blog

Hey all!
If you run a blog, you know that SpamBots can be the bane of any blog's existence. We have an awesome workaround you can implement in about 5 minutes that will add basic captcha protection to all of your blog posts!
1) Go to article.liquid under Themes > Template Editor

2) Add this code to the very top of the file, starting on line 1:
<script type="text/javascript">
     $(document).ready(function() {
       var n1 = Math.round(Math.random() * 10 + 1);
         var n2 = Math.round(Math.random() * 10 + 1);
       $("#question").val(n1 + " + " + n2);
      $(".comment-form").submit(function (e) {
              if (eval($("#question").val()) != $("#answer").val()) {
                     $("#answer").css('box-shadow', '0px 0px 7px red');
It should look like this:
3) Add the following code in the form at the end, but before the submit button (default is line 88):
        <br/>How much is: <input type="text" disabled="disabled" id="question"/>
        <br/>Answer:* <input type="text" id="answer"/>
Make sure you save your changes, and the finished product will look like this:

Happy blogging, everyone! :)
If you enjoyed this article, you might also like..