Twig Templates : Include dynamic data when using set I'm trying to use the Encode Email plugin to encode email addresses.

The email addresses are dynamic so I need to include the output from the database when I'm using set.

This is their example that doesn't use dynamic info:

{% set email = "&lt;a href='mailto:you@example.com'&gt;Your Name&lt;/a&gt;" %}
{{ email | rot13 }}


And this is what I've tried that doesn't work.

{% set email = "&lt;a href='mailto:{{ contactInfo.contactEmail }}'&gt;{{ contactInfo.contactEmail }}&lt;/a&gt;" %}
{{ email | rot13 }}


Is there a way to include the dynamic variables into the set statement?
The main thing to remember about Twig... You never need to nest tags within other tags. So putting {{ }} within {% %} is never going to work.

To concatenate a string in Twig, use the ~ character...

{% set email = "&lt;a href='mailto:" ~ contactInfo.contactEmail ~ "'&gt;" ~ contactInfo.contactEmail ~ "&lt;/a&gt;" %}