So I have a textarea with summary and I want to display the summary before the content. So if I just use {{ content.body }} the text is displayed without the summary.

How can I get the summary ?

{{ content.body.summary }} doesn't seem to do the trick


In your THEME.theme file you can just define it too:

function THEME_preprocess_node(&$variables) {
$variables['node_teaser'] = ['#markup' => $variables['node']->body->summary];

And then display it with:

{{ node_teaser }}

The only way I managed to solve this is:

if you only want to target the value of the summary, you can target the entity you're on. If you're on a node then you can do this :


In a paragraph


You can also get the summary front content like this :


Not great but will do for now.

  • 2
    That IS the only way to use the node object, because content.body is the render array of the body field how you configured in the view mode and if you didn't change it, it will render the full view. – 4k4 Feb 4 '16 at 11:58

To build on what 4k4 wrote (and updated for 2018):

You first choose the way you'd like the field formatted, then you print it.

1) Go to Structure > Content Types > YOUR CONTENT TYPE > Manage Display > YOUR VIEW MODE.

2) Under the "Formatter" column, choose "Summary or Trimmed."

3) Save.

4) In your twig file you should be able to just print {{ body }} (this is what works for me, but correct me if I'm wrong and I'll update).

This works for me using the node in a View block, and should work on the node as well.

  • 1
    +1 This the ideal way to trim the content. In this, the site administrator can configure the trim limit as well no need of a developer help. – Aryashree Pritikrishna Apr 6 '20 at 14:58

I got it to work by simply using

{{ content.field_description['#items'][0].summary }}

wherein my description field is field_description

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.