I'm using SendGrid online "Design" template, with a module "code".
In their documentation (https://sendgrid.com/docs/ui/sending-email/editor/#code-modules), they say that de code editor does not modify or validate any HTML.
If I write this piece of code inside the code module:
<ul>
{{#each items}}
<li>test</li>
{{/each}}
</ul>
<table>
<tbody>
{{#each items}}
<tr>
<td>Col 1</td>
<td>Col 2</td>
</tr>
{{/each}}
</tbody>
</table>
it results in:
<ul>
{{#each items}}
<li>test</li>
{{/each}}
</ul>
{{#each items}}{{/each}}
<table>
<tbody><tr>
<td>Col 1</td>
<td>Col 2</td>
</tr></tbody>
</table>
We can see that the {{each}}
function stays in the right place for the ul
, but is remove from inside of the table
. Is this a temporary bug? How can I do this simple operation?
Thanks for your help
Handlebars syntax allows you to personalize the messages in your templates by inserting customers' names and other data to make an email relevant to each individual recipient.
Sendgrid dynamic template uses handlebarjs syntax to replace variables with values in HTML. The template contains variables with double curly braces. Below code is converted to html by replacing name with actual value in plain text.
I found a undocumented way to make this works. You will need to comment out the each
helper like this:
<table>
<tbody>
<!-- {{#each items}} -->
<tr>
<td>Col 1</td>
<td>Col 2</td>
</tr>
<!-- {{/each}} -->
</tbody>
</table>
I get the same issue. Definitely a bug in the Design Editor. My work around was to:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With