escape_once

Escape unescaped HTML characters without modifying existing entities, preventing double escaping.

Syntax

{{ html_string | escape_once }}

Example

{% assign snippet = "<b>Pro</b> & Basic" %}{{ snippet | escape_once }}

Output

<b>Pro</b> & Basic

The escape_once filter escapes special characters without double-encoding already escaped HTML entities, converting raw ampersands while preserving valid entities like < and & intact.

On programmatic landing pages, escape_once handles mixed-source text feeds where some entries arrive pre-sanitized from external CMS databases. For example: {{ row.description_snippet | escape_once }}. This guarantees clean typography on public pages without ugly double-escaped artifacts like & appearing in rendered headings.

Try this syntax in the editor.