enter image description here

I want to customize the article type node pages. I created a twig file :


What code should I put in this file to display the "Description" field ?


enter image description here

3 Answers 3


Rendered output of this field

{{ content.field_article_description }}
  • Thank you, it works. One last question. How to display a block and a flag on the page with twig ?
    – user83671
    Mar 5, 2018 at 15:02
  • for block look at this drupal.stackexchange.com/questions/207377/… ... for flag not sure what you mean ... perhaps form a new question ?
    – GiorgosK
    Mar 5, 2018 at 15:17
  • the fieldblock module can probably do what you are looking for, although there is also a chaos tools submodule that can give one view mode as a block. drupal.org/project/fieldblock
    – HongPong
    Aug 3, 2018 at 20:50

Also note that if you need to exclude a specific field from the general content area even if it is set to display (which is what you have to do to get it into the render array) then this works:

   {#We hide the comments and links now so that we can render them later.#}
  <div{{ content_attributes }}>
    {{ content|without('comment', 'links', 'field_tags', 'field_machinename') }}

and then where you need it to appear:

      {{ content.field_machinename }}

GiorgosK's answer should work, unless you have a layout set in the Manage Display tab, in which case you may need to use something like {{ content._field_layout.content.field_article_description }}

Your Answer

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