We have several fields on our Article
content type, one of which is a Link
field. In a twig
template we would like to display a <section>
such that all of it is clickable with different fields inside of it.
Current node--article.html.twig
<section>
<a href={{ url }}>{{ label }}</a>
<div>{{ content.body }}</div>
<div>{{ content.field_subtitle }}</div>
<div>{{ content.field_category }}</div>
</section>
Modified node--article.html.twig
template to make entire <section>
clickable (desired output).
<a href={{ url }} >
<div>{{ content.body }}</div>
<div>{{ content.field_subtitle }}</div>
<div>{{ content.field_category }}</div>
</a>
Is there another way I should be doing this?
I was looking for something similar to below. It would output what is under the Modified node--article.html.twig
(above)
{{ link(label, url)|insert(content.body, content.field_subtitle, content.field_category) }}