Protect sensitive info (emails/phone numbers) on your Jekyll site from scrapers and bots.
- Add
jekyll-js-protect
in yourGemfile
like so
gem 'jekyll-js-protect'
- Run
bundle install
There are 3 Liquid Filters that this plugin exposes, string_protect
, email_protect
and tel_protect
.
email_protect
and tel_protect
will add mailto:
and tel:
links resepectively.
For other info (or if you don't want your email/number to be clickable) use the string_protect
tag.
The markup below
Bots can't read this: {{'I like pineapples' | string_protect}}
My email address is {{'dont@spam.me' | email_protect}}
You can call me at {{'9999999999' | tel_protect}}
Renders:
![image](https://private-user-images.githubusercontent.com/23417273/267763805-658c2263-11aa-4412-973b-0c92a2f34dd0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjY4NzEsIm5iZiI6MTczOTM2NjU3MSwicGF0aCI6Ii8yMzQxNzI3My8yNjc3NjM4MDUtNjU4YzIyNjMtMTFhYS00NDEyLTk3M2ItMGM5MmEyZjM0ZGQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDEzMjI1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkzZGQ5YWYxNzM3MjgxYTBhYTE3YTRhMWZjY2RlYmNjODQ2ZjhkNWRhNTliMTVkNGJmZDBjZDNlMmM2NmUzYzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BML5lK8ql62h-OIeW6nMpJYPXACzCGNzAHSoCj4zDlQ)
- The input to the Filter is encoded in Base64 then prefixed with a code
- A Jekyll Hook adds a tiny JS file to your pages
- When the JS file loads it decodes the encoded info
- Since webcrawlers used for collecting emails do not typically have a JS stack it protects against such bots
- A
<noscript>
fallback is provided for when JS is disabled.
![image](https://private-user-images.githubusercontent.com/23417273/267767869-64b4fd1c-53e0-4e9e-ba03-fc31d0de3ab7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjY4NzEsIm5iZiI6MTczOTM2NjU3MSwicGF0aCI6Ii8yMzQxNzI3My8yNjc3Njc4NjktNjRiNGZkMWMtNTNlMC00ZTllLWJhMDMtZmMzMWQwZGUzYWI3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDEzMjI1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRlMzAzODM0YzBjY2FiN2ExNjFjYTlmMWM5N2UxN2UzYmJlYjA3ZTY3MzJiZTRhYmU4OGM4ZWY2OTQ1Mjg3MjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.xz56yXyxHgNQ3xGuztXECYrH5f-K7ZyR049PBpzCR_E)
- It is assumed that anyone who chooses to disable JS on their browser knows how to decode Base64 strings