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 Answer
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();
}