Fetching and rendering custom-library generated blocks in twig I am using the following code in my theme to fetch 3 blocks (each containing 4 fields) generated via the custom block library interface i:e all 3  block are of the HomePage-Block type:

function legislation_research_theme_preprocess_page(&amp;$variables, $hook) {
    for($i = 1; $i &lt;= 3; $i++) {
        $block_entity = Drupal\block_content\Entity\BlockContent::load($i);// BLOCK_ID
        $block_view[$i] = \Drupal::entityTypeManager()-&gt;getViewBuilder('block_content')-&gt;view($block_entity);
    }

    if ($block_view) {
        $variables['page']['my_block'] = $block_view;
    }
}


In my page--front.html.twig, my blocks output via:

    {{ page.my_block }}


However, the output is of the individual fields from each of the blocks rather than 3 divs containing 4 fields of content from each block. That's making it impossible to to style:



Can anyone advice how I might be able to output each block but contained in individual parent divs?
I render my custom library blocks like this:

{{drupal_entity('block', 'block_id')}}


So you have to search your block at your library and use this block's machine name where i say block_id.
Hope it helps.