truncate

Shorten text to a character limit.

View Markdown

Syntax

{{ value | truncate:100 }}{{ value | truncate:(100, "...") }}

Usage

  • The required first parameter is a non-negative character limit.
  • The suffix defaults to . Pass a second parameter to replace it, or "" to omit it.
  • The suffix counts toward the character limit and is clipped when it is longer than the limit.
  • Unicode grapheme clusters such as emoji count as one character.
  • For arrays and objects, including serialized collections from another filter, string values are formatted recursively while keys and non-string values are preserved.

Examples