Very simply put, I want to print the plain text from the title field of my node without any additional html. Currently I have this in my node--custom-template.html.twig file

<h3 class="fancy">
      {{ label }}      

but it outputs it like this

<h3 class="fancy">
          <span data-quickedit-field-id="node/13/title/en/teaser">My Title</span>      

I'd like it like this

<h3 class="fancy">My Title</h3>

I've tried using some of the twig filters like |striptags and |raw, but then nothing displays. I'm wondering if there is a template I could edit for this field, or any other way to just get the plain text string of the node title.

1 Answer 1


You can get the unformatted title from the node object:

{{ node.label  }}
  • 1
    I also discovered that if you need more control over how the title displays you can use the twig template field--node--title.html.twig - just another option. Commented Dec 5, 2016 at 9:00
  • {{ label.0 }} also works in Drupal 9
    – doppler
    Commented Apr 18, 2023 at 21:24

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.