If you think you will regularly need blocks that contain similar, but not identical content, you can define elements within the block to be optional. This means you can define one block with multiple elements and then select in the campaign which elements to use, saving you the effort of creating a unique block for every permutation. This is done by adding the e-optional
attribute.
By default, all optional content elements are enabled. To disable optional content elements, open the required email campaign, hover your mouse over the content block you would like to modify and click the Manage optional content icon. For more information, see Optional content.
<e-optional name="Shop now CTA">
<tr>
<td align="center">
<a href="" e-editable="shopnowctaurl" target="_blank" title="Shop now CTA" class="cta-big">
<span e-editable="shopnowcta">Shop now</span>
</a>
</td>
</tr>
</e-optional>
As with the e-editable attribute, every e-optional name identifier must be unique within each content block. This is what lets you enable or disable the element in the content editor. If you have two or more elements with the same e-optional name identifier, then disabling one in the text editor will automatically disable those elements within that block. Other blocks with the same unique identifiers will not be affected.
Example of a content block with three optional elements:
<e-optional name="Headline">
<tr>
<td align="center" class="lh">
<span e-editable="Headline" class="h1">BIG DISCOUNT!</span>
</td>
</tr>
</e-optional>
<e-optional name="Copy">
<tr>
<td align="center" class="copy-text">
<span e-editable="copy" class="la-copy">Don't miss it, get it now.</span>
</td>
</tr>
</e-optional>
<e-optional name="Shop now CTA">
<tr>
<td align="center" class="dpt20lr10">
<table cellpadding="0" cellspacing="0" border="0" class="olbg1">
<tr>
<td align="center" class="oltd1">
<a href="" e-editable="shopnowurl" target="_blank" title="Shop now CTA" class="cta-big">
<span e-editable="shopnowcta">Shop now</span>
</a>
</td>
</tr>
</table>
</td>
</tr>
</e-optional>
In this example, the block has a heading, some text and a call to action button. In the content editor you will be able to decide whether to use one, two or all three of these.
As you can see, you can still use the e-editable
attribute within the e-optional
one.
Mobile first
With mobile taking an ever-growing share of the e-commerce market, you need to be sure that all your marketing emails look good on mobile devices. All Emarsys templates are mobile-optimized by default (unless explicitly requested otherwise), but the Block-based Editor also provides easy functionality for hiding sections on mobile, defining custom mobile images and mobile previews.
If you are building your own templates, this article can help you make sure that your email design looks good on mobile, as well as desktop: Mobile-optimized custom HTML