Render block programmatically in Drupal 8 returns 0 I create a block at /admin/structure/block/block-content and I want programmatically render it in our custom template files. What I did is 

function hook_preprocess_page(&amp;$vars) {

    $block = \Drupal\block_content\Entity\BlockContent::load(2);
    $vars['contact-us-info-block']= \Drupal::entityTypeManager()-&gt;getViewBuilder('block_content')-&gt;view($block);
    //kint( ($vars['contact-us-info-block']));
    //kint( drupal_render($vars['contact-us-info-block']));
}


and in page template file I try

&lt;p&gt;{{ contact-us-info-block }} &lt;/p&gt;


but I only see a "0" in output.

if I use  

$vars['contact-us-info-block'] = drupal_render($vars['contact-us-info-block']);


everything is Ok but I find out drupal_render is deprecated in Drupal 8.
Where is problem and how can I render a block at page template programmatically?
For display only your block in your templates with preprocess the best way is 

$block = Block::load('my_block_id');
$variables['My_region'] = \Drupal::entityManager()
      -&gt;getViewBuilder('block')
      -&gt;view($block);


And in your page.html.twig or node.html.twig or xxx.html.twig use your variable My_region like this :

{% if page.My_region %}
    {{ page.My_region }}
{% endif %}


And in rendable array (custom module) by exemple into an controller custom in content():

public function content() {
    $block = Block::load('my_block_id');
    $block_content = \Drupal::entityManager()
      -&gt;getViewBuilder('block')
      -&gt;view($block);

          return array(
            '#type' =&gt; 'container',
            '#attributes' =&gt; array(
            'class' =&gt; array("Myclass"),
          ),
           "element-content" =&gt; $block_content,
           '#weight' =&gt; 0,
  );
}


drupal_render is not usefull drupal already assume the render in D8 and this is deprecated (https://api.drupal.org/api/drupal/core!includes!common.inc/function/drupal_render/8)

it's a bit heavy, it is better to use the maximum area system and does not add load block from the preprocess. In the case of using a controller in your modules this seems a justified use.