foundation-emails icon indicating copy to clipboard operation
foundation-emails copied to clipboard

Partials in custom data

Open Stadly opened this issue 7 years ago • 0 comments

Consider the following template:

layouts/default.html:

<!-- static part 1 -->
{{{section1}}}
<!-- static part 2 -->
{{{section2}}}
<!-- static part 3 -->
{{> body}}
<!-- static part 4 -->

pages/newsletter.html:

---
section1: |
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
    <spacer size="12"></spacer>
    <p>Etiam et laoreet nisi.</p>
section2: |
    <p>Sed et leo blandit, auctor odio.</p>
    {{> delimiter}}
    <p>Mauris eu auctor nibh, a luctus nibh. Cras.</p>
layout: default
---
<p>Integer lacinia hendrerit nulla, eget feugiat diam elementum.</p>
<spacer size="24"></spacer>
<p>Ut consequat malesuada interdum. Pellentesque consequat.</p>
{{> delimiter}}
<p>Proin magna turpis.</p>

partials/delimiter.html:

<hr/>

This is compiled into the following email:

<!-- static part 1 -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<table class="spacer"><tbody><tr><td height="12px" style="font-size:12px;line-height:12px;">&#xA0;</td></tr></tbody></table> 
<p>Etiam et laoreet nisi.</p>

<!-- static part 2 -->
<p>Sed et leo blandit, auctor odio.</p>
{{> delimiter}}
<p>Mauris eu auctor nibh, a luctus nibh. Cras.</p>

<!-- static part 3 -->
<p>Integer lacinia hendrerit nulla, eget feugiat diam elementum.</p>
<table class="spacer"><tbody><tr><td height="24px" style="font-size:24px;line-height:24px;">&#xA0;</td></tr></tbody></table> 
<p>Ut consequat malesuada interdum. Pellentesque consequat.</p>
<hr>

<p>Proin magna turpis.</p>

<!-- static part 4 -->

As you can see, the <spacer> element is compiled into a <table class="spacer"> element both in the custom data section1 and the body of the email. Great!

However, the partial partials/delimiter.html is only compiled in the body of the email, and not in the custom data section2.

It would be really useful if partials were also supported in custom data.

Stadly avatar Feb 16 '18 10:02 Stadly