Better support for cloaking email addresses in "mailto:" links
Opened this issue · 0 comments
If you have a template like this:
<p>
Contact by email: <a href="mailto:$SiteConfig.Email.Cloak()">$SiteConfig.Email.Cloak()</a>
</p>
You will notice that the cloaking will break the href
attribute of the a
element. There should be a better way to cloak email addresses that are present in any HTML attribute values.
One solution is to set the following config option:
---
after: cloakemail
---
Taitava\CloakEmail\CloakEmail:
template_insert_links: true
And then you can simplify your template file:
<p>
Contact by email: $SiteConfig.Email.Cloak()
</p>
Then the module will generate the a
element automatically for you and the cloaking should perform just fine. While this might work in many cases, it introduces another problem: The generated a
element cannot be customised at all. And another thing is that automatically generating elements is not always very clear when looking at the template source code.
So some planning is needed to figure out how to cloak email addresses properly in HTML attributes.