I want to write an entire loop into a field like this:

enter image description here

Obviously this is not working. What would be the correct syntax when twig is written inside a field?

Also is there a name for the twig tags inside a field? I have a hard time searching the interwebz for this.


1 Answer 1


You can by using this: {{ include(template_from_string(entry.fieldName)|raw) }}

You could also try it with just |raw But that probably only works for just HTML

This works on both a Plain Textfield aswell on a Richtext area. Although I wouldn't recommend putting code in your textfield's like that.

The original answer on a simular question can be found here: https://craftcms.stackexchange.com/a/1270/3848

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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