When printing a text field we just want to display the value. When printed as is in a twig template ({{ content.field_subtitle }}
) we get the following output.
Currently we are attempting not to use the |raw
filter so we are just using {{ content.field_subtitle|render|striptags }}
.
Are there alternatives to this approach without having to create another twig template for the field? We are having a hard time finding an alternative.
Setup:
- Basic page content type has field field_subtitle where type is text(plain)
- no twig template has been created on the field, only the content type
node--page.html.twig
Current setup in twig template
<div class="myclass__subtitle>
{{ content.field_subtitle|render|striptags }}
</div>
Current output:
<div class="myclass__subtitle">
<div class="field field--name-field-subtitle field--type-string field--label-hidden field__item">Intrinsicly harness interactive functionalities.</div>
</div>
Desired output:
<div class="myclass__subtitle">
Intrinsicly harness interactive functionalities
</div>