I've placed a view block via Twig Tweak in page-front.html.twig before and it worked fine. That was on Drupal 8, but now I'm on Drupal 9. This's what I would have done in Drupal 8.

<div id="library_carousel">{{ drupal_view('library_carousel ', 'block_carousel') }} </div>

This is what I gather I'm supposed to do in Drupal 9.

<div id="library_carousel">
    <div>{{ drupal_view('library_carousel ', 'block_carousel') }} </div>

It's not rendering anything. In Views, it shows the view machine name as 'library_carousel'. Inside the view, it shows the block machine name as 'block_carousel'.

I've confirmed that if I place the block via the Drupal interface, it does render correctly. I just can't get it to render via Twig Tweak. And yes, I've flush all the caches multiple times. Also, I have other things in the page-front twig that render correctly so I know the template is rendering in general.

Why isn't working?

  • 3
    You see the empty space there in 'library_carousel '?
    – leymannx
    Feb 2, 2021 at 22:09
  • 1
    @leymannx, thank you so much for catching that. I been over that block of code over and over and that never jumped out at me. It's working now.
    – Chanel
    Feb 3, 2021 at 15:15
  • Haha, yeah sometimes that happens. You spend hours of debugging to only find out it's been a typo. 😸
    – leymannx
    Feb 3, 2021 at 15:33

1 Answer 1


There's a section in the docs explaining how to print blocks even if they are disabled. Maybe that's your problem.

Disabled blocks won't be printed unless you suppress access control as follows.

{{ drupal_entity('block', 'block_id', check_access=false) }}

Is working on D9 for me.

Not the answer you're looking for? Browse other questions tagged or ask your own question.