in {{blog.content}}
I want to limit the viewer to see only 50 char at most, how can I do that using jinja2?
After searching through their documentation I have found that {{ s|autolink[ length[ nofollow]] }}
has a length property but it will make it auto link! Which I don't want it to be.
Have you tried the python slice notation?
{{ blog.content[:50] }}
The documentation for jinja2 says to use {{ blog.content|truncate(50) }}
. Thats what I have been using thus far.
You can find the docs for template here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With