Jun 8, 2009

Blocking Reddit from Blogger

Over the year and a half or so that I've been writing this blog, a number of my posts have been put onto reddit by their search bot, gst - at least I think it is a search bot, I don't think anybody could have posted as many articles as they have unless they are sitting there reading blogs 24/7 - or maybe it is actually multiple people, who knows. Anyway, some posts were well liked, some were not, but in the end it doesn't really matter to me.

There is a good and a bad side to reddit. The people who like my stuff either just leave (possibly putting a vote up on reddit) or they subscribe and continue reading and occasionally share an intelligent comment. This is welcome. What does bug me is the people who just come in, leave a nasty comment or two like "yer gay" or something and fuck off. These people contribute absolutely nothing and when I'm having a bad day it is not the kind of email I want to come home to.

So anyway, I wrote up a little script to block out reddit traffic. To install this on your Blogger blog, just click the "Layout" tab, go to "Edit HTML" and drop this somewhere outside of a CSS tag:
if (document.referrer.match(/reddit\./)){
window.location = document.referrer;
This basically just boots them back to reddit. It won't affect them if they copy+paste the URL into their browser, but I figure if they're willing to go through that much effort to read your stuff they actually want to read your stuff and probably aren't going to troll.


IcyLiquid said...


if (document.referrer.match(/reddit/)){
window.location = document.referrer;

This matches on any occurrence of the word 'reddit' in the referrer.


Like this one :D

If someone tries to navigate on your site after hitting this link, they will enter a delicious infinite loop of win.

Sigh... *facepalm*

Michael Mol said...

I don't think gst is run by Reddit. It might be run by one of the proggit moderators, or by some spam artist who wants a high reputation so that he can link to his own ad-laden sites every now and again. Even the folks on proggit loathe gst.

(Incidentally, I started following your blog when I found it via Reddit ages ago...)

Rob Britton said...

@IcyLiquid: Oops!

@Michael Mol: Yeah I was hesitant to block Reddit originally since I know some of the people who follow this blog found it that way. I may not keep the Reddit blocking thing up, since I do know that in the massive flood of traffic that comes from that site there are some people who actually have some intelligent things to say.