1. Home
  2. Liquid
  3. Truncate

Trim string to the number of characters specified. By default the truncated string will end with ellipsis (...) however you can replace it by passing your ending as the second parameter.

#liquid#string#filter
{{  "Some string to be truncated" | truncate:9 }}
    String...
{{  "Some string to be truncated" | truncate:9, "...trimmed" }}
    String...trimmed
copy
Full Liquid cheatsheet