strip_html
Strip all HTML tags and markup elements from a string, leaving only plain text.
Syntax
{{ html_string | strip_html }}Example
{% assign html = "<h3>Featured</h3><p>Full description</p>" %}{{ html | strip_html }}Output
FeaturedFull descriptionThe strip_html filter scans an input string and removes every HTML opening and closing tag, leaving only plain, unformatted text characters behind.
In programmatic SEO workflows, strip_html sanitizes rich-text marketing copy for inclusion in plain-text meta descriptions, Open Graph cards, or image alt attributes. For example: <meta name="description" content="{{ row.body_html | strip_html | truncate: 155 }}">. This prevents unrendered HTML tags from leaking into search engine result page snippets.
Filters
- abs
- append
- at_least
- at_most
- capitalize
- ceil
- compact
- concat
- date
- default
- divided_by
- downcase
- escape
- escape_once
- first
- floor
- join
- last
- lstrip
- map
- minus
- modulo
- newline_to_br
- plus
- prepend
- remove
- remove_first
- replace
- replace_first
- reverse
- round
- rstrip
- size
- slice
- sort
- sort_natural
- split
- strip
- strip_html
- strip_newlines
- times
- truncate
- truncatewords
- uniq
- upcase
- url_decode
- url_encode
- where
- raw
- slugify
- number_format
