Blogs: Add simple captcha to commenting

This code customization adds a basic math based captcha to your article comments form. 

Example:

Difficulty: Intermediate-easy. Requires you to modify Liquid code. Having a backup is recommended in case of errors.

How to:

1

Edit article.liquid from the sections folder

Open the Code Editor:

From the sections folder, open article.liquid:

In the code area, use the Find feature (Command-F on Mac, Control-F in Windows) and search for:

type="submit"

That will take you to the submit button code:

Add a couple or more blank lines above that line:

Paste the following code in that new section (above the input submit line):

Click to view code

Example:

Next,

Scroll to the very bottom of the same file and add this code to the bottom:

Click to view code

Example:

Be sure it's added after the endschema line - Add a couple or more blank lines before pasting the code. 

Save the file:

You can now test the comments form on your blog posts. If you don't have commenting turned on, be sure to enable in the Blog settings of your main Shopify Admin.