Sometimes you need a body text that is trimmed. No need to install contrib modules. Here's a little snippet:

{% set text = content.body|render|striptags %}
{{ text|length > 200 ? text|slice(0, 200)|raw ~ '...' : text|raw }}

 


Saved you some valuable time?

Donate and get more free time-saving code on this website in the future.