Skip to content

Truncate ​

Shortens a string to a number of characters. When the string is longer than this number, the filter adds an ending. The default number is 100 and the default ending is .... The ending is not part of the count.

liquid
{{ string | truncate: number, ending }}

Example ​

liquid
{{ 'Ground coffee from Ethiopia' | truncate: 12 }}
{{ 'Ground coffee from Ethiopia' | truncate: 12, ' [more]' }}

Output

html
Ground coffe...
Ground coffe [more]