obfuscatestring
11ty plugin for obfuscating strings
This plugins enables the obfuscating of strings. I mainly use it to prevent harvesting.
Install
$ npm install @achilleus/obfuscatestring
Configuration
In the upper section of your configuration file, usually .eleventy.js
, add the following
const obfuscate = require("@achilleus/obfuscate");
Within the module.exports
functionality, add
eleventyConfig.addPlugin(obfuscate);
Usage
In your templates, you now can add the filter to the output:
{{ 'foo@bar.org' | obfuscate | safe }}
In the generated file this will be outputted as
foo@bar.org
However, the visitor of your site will see
foo@bar.org
The Nunjucks safe
filter prevents the output from being escaped. See https://www.11ty.dev/docs/layouts/
Buy me a coffee
If you like this plugin, you can Buy me a coffee.
Credits
Inspiration was taken from the example at https://coderwall.com/p/jpd4zq/simple-method-to-obfuscate-strings-in-javascript by David Long