Skip to main content

How to hide/show content in the editor preview

There are times where you may want to hide content in the preview in the editor that your marketers see, but that you still would like to include in the export output. Perhaps you have a particularly ugly piece of ESP code that needs to be embedded in the email and you want to hide it.

To do this you can make use of the render_mode property on the Render Context object.

The render_mode property will be set to editor_preview when the email is being previewed in the editor, and export when the email is being exported.

Example

<html>
<body>
<div>
{% if render_context.render_mode == 'export' %}
<p>CONTENT TO HIDE</p>
{% endif %}
</div>
</body>
</html>

In this example, the <p>CONTENT TO HIDE</p> will only be visible in the export output, not in the editor preview.