Skip to content Skip to footer navigation
🏰 Statamic Summit 2027 Feb 16–19 Talks, workshops, and three nights in a German castle. Get Tickets

Collapse Whitespace Modifier

Trims a string and replaces consecutive whitespace characters with
a single space. This includes tabs and newline characters, as well as
multibyte whitespace such as the thin space and ideographic space.

title: Bad at typing
{{ title | collapse_whitespace }}
{{ Statamic::modify($title)->collapseWhitespace() }}
Bad at typing