Output node reference field data in page.html.twig I have a homepage node-type in which I have an entity-reference field holding 3 references to 3 separate custom blocks.

The theme I'm working on requires that my 3 element reference field needs to be output in page.html.twig. I have overridden page.html.twig and I can see changes I have introduced once my caches are cleared.

My research led me to implementing a custom module to preprocess my homepage ouput and include the data I want printed from page--front.html.twig, code below:

function mymodule_preprocess_page(&amp;$variables, $hook) {
    // $url_obj = Url::fromRoute('&lt;front&gt;');
    die('tested');
    dsm($variables);
    drupal_set_message('testing');
}


My problem is my preprocess function is not triggered. The module is enabled, and calling die() outside a function does "kill" the site, so the module file is recognized.

I would appreciate any help.
Module names are all lowercase or underscore. Your preprocess function name must start exactly with the same name as your module/theme. Never uppercase.

function mymodule_preprocess_page(&amp;$variables) {
  ...
}


And there is no $hook parameter in this case, the _page function name suffix already declares this function as a specific hook only for the page hook type.