i've made a twig file for my 'test' content type called node--test.html.twig. That works fine using {{ content }} to print the node.

I've a custom field with the machine name field_text, the following prints fine: {{ node.field_text.value }}

For some reason i cant get {{ content.field_text }} to work. I also can't get content.body or any other subset of content to work in any node type.

I must be doing something really daft - thanks for the help

  • The solution was to uninstall Field Layout module (a core - experimental module).
    – amcc
    Aug 21, 2017 at 12:16

1 Answer 1


content.<field_name> should work. try adding {{ dump(content|keys) }} to your template, does it show anything?

  • i get the following: website/vendor/twig/twig/lib/Twig/Extension/Debug.php:60: array (size=1) 0 => string '_field_layout' (length=13)
    – amcc
    Aug 21, 2017 at 11:14
  • if relevant - i'm using bootstrap within a subtheme
    – amcc
    Aug 21, 2017 at 11:18
  • - just tried with other themes, it doesn't make any difference.
    – amcc
    Aug 21, 2017 at 11:36
  • 1
    Do you have anything special installed? Any idea where the _field_layout comes from? I'm using bootstrap aswell, it should work the way you are trying so I'm guessing you are using some module that changes the templates? Try setting debug: true in the twig.config-section in sites/default/services.yml, after that the page source code should tell you which templates are being used. Aug 21, 2017 at 11:51
  • 1
    Field Layout is a core experimental module - can't remember why i enabled it - may have been enabled by something else i was playing with. I've uninstalled it and its all working now! Thanks very much both of you - I will upvote as soon as my newbie reputation status on this forum allows
    – amcc
    Aug 21, 2017 at 12:15

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.