How can I limit the length of the text, e.g., 50, and put three dots in the display?
{% if myentity.text|length > 50 %}
{% block td_text %} {{ myentity.text}
Use the truncate filter to cut off a string after limit is reached
{{ "Hello World!"|truncate(5) }} // default separator is ...
Hello...
You can also tell truncate to preserve whole words by setting the second parameter to true. If the last Word is on the the separator, truncate will print out the whole Word.
{{ "Hello World!"|truncate(7, true) }} // preserve words
Here Hello World!
If you want to change the separator, just set the third parameter to your desired separator.
{{ "Hello World!"|truncate(7, false, "??") }}
Hello W??