Use different page template base entity bundle (for node, base content type)

Submitted by august on Sat, 01/26/2019 - 00:19

Use different page template base entity bundle (for node, base content type)

Add hook_theme_suggestions_HOOK_alter to your theme function file(your_theme.theme)

<?php

/**
 * Implements hook_theme_suggestions_page_alter().
 */
function hook_theme_suggestions_html_alter(array &$suggestions, array $variables) {
  if ($node = \Drupal::routeMatch()->getParameter('node')) {
    $suggestions[] = 'html__' . $node->bundle();
  }
}

And also can use `hook_theme_suggestions_html_alter` for `html.html.twig`

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.