Skip to main content
All CollectionsAutomationTemplates
Render HTML from your custom Smart Fields
Render HTML from your custom Smart Fields

Learn how to safely render HTML content in your templates using the |safe filter.

Kolleno Support avatar
Written by Kolleno Support
Updated over 7 months ago

Overview

The |safe filter allows HTML stored in variables to be rendered directly in your templates. Use it when you trust the HTML content to be safe from XSS vulnerabilities.

Example

If you have HTML content stored in a variable, you can mark it as safe for rendering using the |safe filter. For instance:

{{ customer.extra_data.my_smart_field|safe }}

This code snippet tells the template engine to render the HTML content of customer.extra_data.my_smart_field directly onto the web page without escaping it.

Use this approach cautiously and ensure the content does not contain any user-inputted data to mitigate security risks.

Did this answer your question?