Drupal - Using Twig how can I get the summary of the body field to use in a template?

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 :

node.body.summary

In a paragraph

paragraph.field_body.summary

You can also get the summary front content like this :

content.body['#object'].body.summary

Not great but will do for now.


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

function THEME_preprocess_node(&$variables) {
$variables['node_teaser'] = $node_array['body'][0]['summary'];
}

And then display it with:

{{ node_teaser }}

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.