Hi. I’m trying to add a reply via email in single.html template and incorporate hugo-cloak-email theme plugin.
My current template is:
{{ with .Site.Social.email }}
<a href='mailto:{{ . }}?subject={{ i18n "email-subject" }}"{{ default $.Site.Title $.Page.Title }}"'>Reply via email</a>
{{ end }}
It creates a reply button emailed to .Site.Social.email
with a dynamic subject of the page title. The problem is the email is exposed to spammers.
Hugo cloak email
When the hugo-cloak-email theme plugin is used:
{{< cloakemail "hi@example.com" >}}
This is what is rendered in the front end:
hi@example.com
But the email is hidden in the page source:
<style>
#span-72381b06.cloaked-e-mail:before {
content:attr(data-domain) "\0040" attr(data-user);
unicode-bidi:bidi-override;
direction:rtl;
}
</style>
 <span class="cloaked-e-mail" data-user="ih" data-domain="moc.elpmaxe" id="span-72381b06"></span> 
<script id="script-72381b06">
var scriptTag = document.getElementById("script-72381b06");
var link = document.createElement("a");
var address = "ih".split('').reverse().join('') + "@" + "moc.elpmaxe".split('').reverse().join('');
link.href = "mailto" + ":" + address;
link.innerText = address.split('?')[0];
scriptTag.parentElement.insertBefore(link, scriptTag.previousElementSibling);
scriptTag.parentElement.removeChild(scriptTag.previousElementSibling)
</script>
How to get the hi@example.com
in rendered HTML with hugo-cloak-email theme plugin and put it in mailto, while maintaining its cloak capability?
<a href='mailto:{{ . }}?subject={{ i18n "email-subject" }}"{{ default $.Site.Title $.Page.Title }}"'>Reply via email</a>