0

I have a content type that has multiple fields. I'm fine with the generic display view for all but one of those fields. Is it possible to use a twig template to modify only one of those fields?

For example:

Content type: Stuff and Things with Fields: Body, URL, Notes, Status, Peer Review

I want to modify the URL field and leave the rest alone... is this doable, or do I have to render each field in the twig template?

1
0

Target the field template instead of node. Enable twig debugger and then inspect element with browser to see all the template files available to use/override.

You'll see you can use field--[field-name].html.twig or field--node--[field-name]--[content-type].html.twig if you want to be more specific.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.