Snippets in Email Templates

Hi,

I’m trying to use a snippet to include complicated HTML structures in an Email Template (like an invoice details, for example).

image

The snippet does show up in the body preview and I can click on it and set the properties and all, but when the actual email is sent the snippet is not transformed and all I see is the figure tag.

Like so:

<figure data-snippet="test" data-property-prop="Hello" data-property-choice="no">&nbsp;</figure>

Why isn’t the snippet converted? Is it a bug?

Thanks!

Hey @froberts0n

Have you tried updating the mail template to include the |content filter on it?

Hi @daft

I’m sorry but I don’t understand what you mean because I’m not rendering a partial, it’s a snippet. I actually see that the <figure> tag has all the data I’m configuring in the preview pane, but the code of the actual snippet partial is never actually rendered and it stays just a <figure> tag in the final email that is sent. I don’t see where I could put the |content filter here. When I click the snippet icon to insert a snippet, it’s the <figure> tag that’s inserted, not a {% partial %} block. I’m scratching my head…

Thanks!

on template layout is part of code

<td class="content-cell">
     {{ content|raw }}
</td>

or something similiar, you need to use that |content instead of |raw … or maybe both, to correctly render HTML without escaping (as i assume)