Precise truncate chars filter
Template filter that truncates the text when it exceeds a certain number of characters. It deletes the last word only if partial. Adds '...' at the end of the text, only if truncated. Examples (text == 'Lorem ipsum dolor sit amet', len(text) == 26) {{ text|truncatewords_by_chars:30 }} 'Lorem ipsum dolor sit amet' {{ text|truncatewords_by_chars:25 }} 'Lorem ipsum dolor sit...' {{ text|truncatewords_by_chars:21 }} 'Lorem ipsum dolor sit...' {{ text|truncatewords_by_chars:20 }} 'Lorem ipsum dolor...' By Davide Muzzarelli
- filter
- template-filter
- truncate
- truncatewords