truncatewords Filter

String

Argument: n (required) – number of words to truncate to.

Documentation

Truncates a value to n words and appends an ellipsis (…).

 

Variable

blurb_text = 'You are pretty smart!'

Template

{{ blurb_text|truncatewords:3 }}

Result

You are pretty…

Commentary


Did we get something wrong? Is there a use case for the truncatewords filter that we should add? Please let us know.

Send Feedback

Official Documentation
This page last updated on March 6, 2021, 6:12 a.m. EST