Being tired of receiving tons of spam everyday, I wanted to hide my e-mail address in a more efficient way than the usual user at example dot com. I needed to obfuscate my address to spam crawlers while keeping it readable by human beings. I've created a simple Mephisto plugin to help me do so, called MephistoObfuscate.
Basically, this plugin encodes email addresses (or any text you'd like) into Base64 and lets the browser decode them using some JavaScript on the client side. That way, the address is protected from crawlers blindly scanning the HTML page but is still readable by JavaScript-enabled browsers.
Example
Using MephistoObfuscate is pretty straightforward, you can either use a Liquid filter on your templates (useful to show a contact address on the layout, just like the one on the right sidebar of this page):
{{ "user@example.com" | obfuscate }}Or you can use a macro filter within your blog posts:
<filter:obfuscate>user@example.com</filter:obfuscate>Both of these will be obfuscated into something like:
<span class="obfuscated">dXNlckBleGFtcGxlLmNvbQ==l</span>
Which is not something most if not all spam crawlers will understand. While loading the page the JavaScript code will restore the address back into a human readable fashion.
Installing
To install just run
script/plugin install svn://svn.sig11.org/mephisto_obfuscateAfter this, add the javascript include statements into your layout:
{{ 'obfuscate' | javascript }}
That's it, you're done.