October 2018
Intermediate to advanced
332 pages
8h 9m
English
The truncate filter takes a long string, returns a string cutoff at the specified length in characters, and appends an ellipsis, as shown in the following code:
{{ "A Longer Post Body Than We Want" | truncate(10) }}
A Longer...
By default, any words that are cut in the middle are discarded. To disable this, pass True as an extra parameter as follows:
{{ "A Longer Post Body Than We Want" | truncate(10, True) }}
A Longer P...