strip_newlines
Delete all newline and carriage return characters from a multiline text string.
Syntax
{{ string | strip_newlines }}Example
{% assign multi = "Line One
Line Two
Line Three" %}{{ multi | strip_newlines }}Output
Line OneLine TwoLine ThreeThe strip_newlines filter strips out all line break characters, including carriage returns and line feeds, collapsing multiline text blocks into a single continuous line of text.
On programmatic landing pages, strip_newlines cleans up multiline CSV notes before inserting them into JSON-LD structured data or HTML attribute fields. For example: <meta property="og:title" content="{{ row.catchphrase | strip_newlines }}">. This prevents syntax errors in embedded JSON schemas caused by unexpected raw line breaks.
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
