Skip to content

Instantly share code, notes, and snippets.

@ngsctt
Created September 22, 2017 02:29
Show Gist options
  • Save ngsctt/db69ef8d9674c9413c6deb1f42eedee6 to your computer and use it in GitHub Desktop.
Save ngsctt/db69ef8d9674c9413c6deb1f42eedee6 to your computer and use it in GitHub Desktop.
Using character entities to obfuscate email addresses on websites to prevent scraping, in Hugo
baseURL: http://example.com/
languageCode: en-US
title: Untitled
Params:
email: 'user@example.com' # user@example.com
{{ $mailto := "mailto:" -}}
{{ $email := .Site.Params.email }}
<a {{ print "href=" $mailto $email | safeHTMLAttr }}>{{ safeHTML $email }}</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment