Don't get me wrong, I like experimental Cialis and cheap Air Jordans from China as much as the next guy, but when you start getting tons of blog comments per night touting these great offerings it gets a little old. Yes, within weeks of releasing my updated Orchard site into the wild my blog got targeted by spam-bots feverishly posting their gibberish on a regular schedule. Luckily there is a really easy fix for this already built into Orchard. Here’s how...

This may seem like a no-brainer, but the fist step in stopping comment spam is enabling the Anti-Spam module! Brilliant! This module comes with a standard Orchard install but it disabled by default.

enable-anti-spam-module.png
First step, enable the Anti-Spam module

The next step is setting up your Spam settings. The settings under Spam are specific to Google’s ReCaptcha service, which was perfect because that has become pretty much an industry standard. Getting a public and private key was extremely simple by just heading over to http://ww.google.com/recaptcha. In case you don’t know, a captcha is that fuzzy number thing you must match when submitting data on a website which prevents bots (automated code) from posting things like offers for cheap Air Jordans from China.

setup-recaptcha-under-spam-settings.png
Setup your Google reCaptcha account

Next on the agenda is adding the new ReCaptcha part, made available by enabling the Anti-Spam module, onto your Comment content type. To access the Comment definition click Content Definition from the Dashboard and then click Edit next to Comment content type, pretty straight forward. Next, click the Add Parts button and choose ReCaptcha.

add-recaptcha-to-comment-data-type.png
Update Comment content definition to include the ReCaptcha part

Once ReCaptcha is added you’ll see it at the bottom of the Comment content definition, and we are done!

recaptcha-added-to-comment-data-type.png
ReCaptcha part showing up on the Comment content definition

Open up any page on your Orchard site that allows comments you’ll see a shiny new Google ReCaptcha to thwart would be spam-bots.

default-look-of-recaptcha.png
Sorry, no more party rocking’ spam bots :-(

That’s enough to stop the spam, but the default look of the ReCaptcha control rubs me the wrong way, plus it is hanging around under the submit button which is just plain weird. That’s nothing a little Bootstrap styling can’t handle…

custom-look-of-recaptcha.png
It's beautiful...

I have to admit reading the ReCaptcha most of the time is a pain in the ass, but since I get few comments I think it is worth it to prevent a spam-a-thon. For the customized version of my Orchard ReCaptcha control check it out on GitHub here. Oh, and if you see a tweet from me regarding my new cheap Air Jordans in the coming days you’ll know the bots have won. Avenge me!