How to override page title by content type I'm using the pagetitle core module to render a page title. However, for certain content types I want the page main title to be the content type label (e.g. "News") and not the node label (e.g. "Drupal 8 released!").

Is there a simple way to achieve it? My first guess was to use the template_preprocess_page_title but $variables has no context whatsoever about node, node type, etc...
As mentioned by Ivan Jaros You can use hook_preprocess_page_title.

You just have to load the node from the route first, to get some context.

function yourtheme_preprocess_page_title(&amp;$variables) {

  // Load the node entity from current route
  if ($node = \Drupal::routeMatch()-&gt;getParameter('node')) {

    // Load the label of the bundle
    $bundle_label = \Drupal::entityTypeManager()
      -&gt;getStorage('node_type')
      -&gt;load($node-&gt;bundle())
      -&gt;label();

    // Set the page title
    $variables['title'] = $bundle_label;
  }
}


If you just want to use this with certain content types, you can use $node-&gt;bundle() to get the machine-readable name and check against it.