Difference between truncate_words, truncatewords_html and truncatechars_html

Submitted 3 years, 6 months ago
Ticket #222
Views 339
Language/Framework Django
Priority Low
Status Closed

What is the difference between these template tags truncate_words, truncatewords_html and truncatechars_html?

Submitted on Oct 07, 20
add a comment

1 Answer

Verified

truncatewords
Truncates a value to "n" words and appends an ellipsis (…).
truncatechars_html
Truncates a value to "n" characters and appends an ellipsis (…). It does not count HTML tags as characters and closes any tags that were left open as a result of the truncation.
truncatewords_html 
Truncates a value to "n" words and appends an ellipsis (…). It does not count HTML tags as words and closes any tags that were left open as a result of the truncation.
You will get more information and example at 
https://www.djangotemplatetagsandfilters.com/search/?q=truncat

Submitted 3 years, 6 months ago

Thanks!

- Jaanvi 3 years, 6 months ago


Latest Blogs