Skip to content

Search tags, filters, functions and guides.

Tags / autoescape

Tags

autoescape

Change how output is escaped for a section.

autoescape changes how output is escaped inside a section.

page.kiln
<script>
{% autoescape "js" %}
	const title = "{{ page.title }}";
{% endautoescape %}
</script>
Output
<script>
const title = "Tom\u0027s\u0020\u0022best\u0022\u0020page";
</script>

The strategy is a string: "html", "attr", "js", "css" or "url".

Turning escaping off

autoescape false outputs values as they are. Only use it for content you fully trust.

{% autoescape false %}
	{{ trustedHtml }}
{% endautoescape %}

For a single value, the raw filter is usually clearer.