I am working on creating a theme from scratch for Drupal 8 and I am 90% of the way there. I do have a question on how to access variables in the

{{ dump() | raw }}

I have created a page.html.twig and the {{ page.BLOCKNAME }} is working great. But when I try to place {{ title }}, or any variations, I get NULL or nothing at all.

I can see the title in the dump(), but it has ["string":protected]=> so I am not able to access. I was able to create a new block region and move the title there, but the title will not be in the same place from page to page. I would also like to access the content type, node ID, and node url, with some other custom fields I created, but I can't seem to get to those either.

In summary, how do I use the dump() and actually get to the variables that are presented?

  • Simple - title is now a block and not a twig template variable anymore.
    – user21641
    Commented Nov 6, 2015 at 12:24

2 Answers 2


If you wanna see all variables available in your twig template file in Drupal 8 use {{ kint(_context) }}. Don't forget, you must enable kint in devel module settings.

  • No need to use kint when we have a perfectly valid dump out of the box
    – user14980
    Commented Mar 16, 2017 at 12:32

In the page template you shouldn't be printing blocks directly. Blocks should be always printed inside a regions. More information about how to add your custom region can be found here.

If you are printing an already existing region the syntax for that is:

{{ page.region_name }} 

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.