Skip to main content

truncate

string | truncate: number
returns string

Truncates a string down to a given number of characters.

If the specified number of characters is less than the length of the string, then an ellipsis (...) is appended to the truncated string. The ellipsis is included in the character count of the truncated string.

{{ article.title | truncate: 15 }}

Output

How to tell ...
Anchor to Specify a custom ellipsis

Specify a custom ellipsis

string | truncate: number, string

You can provide a second parameter to specify a custom ellipsis. If you don't want an ellipsis, then you can supply an empty string.

{{ article.title | truncate: 15, '--' }}
{{ article.title | truncate: 15, '' }}

Output

How to tell i--
How to tell if
Was this page helpful?