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 Three

The 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.

Try this syntax in the editor.