shorten
Shortens a string to a given number of characters and appends an optional ellipsis, without cutting off words. To avoid open or incomplete HTML tags, all tags will be removed before shortening a string.
@{ variable | shorten (maxChars, ellipsis) }
It is also possible to just use an integer as a shorthand version:
@{ variable | 100 }
Parameters
- maxChars
- The maximum characters of the truncated string.
- ellipsis ...
- A string appended to the returned variable value, in case the value was truncated.
Example
A basic example taken from the pagelist template of the theme skeleton package:
@{ +main | findFirstParagraph | 150 }