No documented way to render body field

Created on 28 August 2020, about 4 years ago
Updated 6 June 2023, over 1 year ago

I am not sure if this is a feature request or an issue but I am not finding any way to render the body field of a basic page content type. From what I can see from the documentation the following should work:

{{ drupal_field('body', 'node', 29469) }}

Unfortunately, this does not work. I have looked on the web and cannot find a solution. Thank you for your help.

As a side note it does seem odd to have to require the node ID. It seems like {{ drupal_field('body', 'node') }} would be nice...

πŸ’¬ Support request
Status

Fixed

Version

2.5

Component

Documentation

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States plato1123

    Looks like there's still no way to render the body field of the current node?

    I'm using a barrio based theme...
    {{ node.body.value|raw }} strips out embedded media entities for some reason...
    {{ content.body.0 }} <-- none of the content ones work in my template for some reason

    And twigtweak can't render the body field either it seems like. I'm surprised {{ drupal_field('body', 'node') }} isn't a thing...

  • πŸ‡·πŸ‡ΊRussia Chi

    {{ content.body.0 }} <-- none of the content ones work in my template for some reason

    That basically indicates that you have not configured the formatter for the body field.

    I've counted at least 5 ways to render body of the current node.

    {{ content.body }}
    {{ content.body[0] }}
    {{ drupal_field('body', 'node', node.id) }}
    {{ node.body|view }}
    {{ node.body[0]|view }}
    
Production build 0.71.5 2024