0

https://www.drupal.org/docs/theming-drupal/twig-in-drupal/twig-template-naming-conventions gives the example of html--node--[nodeid].html.twig for an individual node - what template name can I use for html.html.twig for a content type such as Article?

1

1 Answer 1

0

You can create your own theme suggestions. If you want to create a custom suggestion for html.html.twig, you need to use the hook hook_theme_suggestion_html_alter.

in your theme_name.theme file add the following function:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.