MODX Blog :: I'm blacking out my site on January 18th to protest against SOPA / PIPA
I'm blacking out my MODX site this January 18th to protest against the SOPA and PIPA. While I'm not in the US, and my server isn't either, I may not have a direct threath in these two - but I'm with the techies here that think it will have major impact on everyone if this thing passes.. So I developed a little plugin to black out my site (yet give people who need access to my site the ability to do so).
The plugin, SOPA Blackout, is available from the MODX Extras repo for MODX Revolution and is quite simple.
- On January 18th 2012, between 8am and 8pm (taken from your server time), the plugin will hijack all first requests made to your site (excluding manager access) and show a message explaining real briefly what's going to happen and give them a link for further information.
- In the background the plugin sets a session variable indicating the user has seen the notice. This session variable stores a timestamp which is checked and considered "valid" for three hours, meaning your visitor will only see the blackout once until their session is cleared (browser close) or its been three hours since they saw it.
- The user can either refresh the page (the plugin doesn't change the link) or click a link at the bottom of the page to go forward to what they were looking for.
The notice people will get looks like this (heavily borrowed from this wordpress plugin, licensed as GPL):
Easy enough, users will be alerted and can go on their way. It's a little way to show your support to the anti-SOPA and PIPA movements out there.
The notice serves a 503 service unavailable error, so your search engine results wont be affected, though it's unlikely search engines will be able to index content during the time the plugin is active. The plugin also serves a retry-after header which is calculated based on the "until" time set in the plugin configuration (by default January 18th 8pm) - that should let the crawlers know when it's "safe" to return.
Oh, by the way, if you want to use different times - just go to the Plugin configuration and change the start/until dates there. Just make sure it's a valid date/time syntax and it should adapt easily.