I'm pretty new to Drupal, and very new to Drupal 8. I've created a view, and have set up it up with a display block. I'm trying to render this on a specific page. So, I created a page template and a preprocess hook, created the following function.

function MYTHEMENAME_preprocess_node__13(&$variables) {
 $block = \Drupal\block\Entity\Block::load('views_block__downloads_block_2');
 $block_content = \Drupal::entityManager()->getViewBuilder('block')->view($block);
 $variables['downloads'] = $block_content;

When I place {{ downloads }} in my page template (page--node--13.html.twig) nothing happens.

Any ideas what I might be doing incorrectly?

  • Use this function function mytheme_preprocess_page(&$variables) {....your code ....} ,if you are creating a page template
    – user59414
    Commented Jun 29, 2017 at 5:11

1 Answer 1


When you configure the visibility of the block in UI you can use a standard region and the standard page template.

If you want to do this with a specific page template similar to the question, add a region download to the theme, place the view block in this region and render the region in the page template specific to the node page--node--13.html.twig:

{{ page.download }}

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.