html.html.twig

Same filename in this branch
  1. 10 core/profiles/demo_umami/themes/umami/templates/classy/layout/html.html.twig
  2. 10 core/themes/stable9/templates/layout/html.html.twig
  3. 10 core/themes/claro/templates/classy/layout/html.html.twig
  4. 10 core/themes/starterkit_theme/templates/layout/html.html.twig
  5. 10 core/modules/system/templates/html.html.twig
Same filename in other branches
  1. 9 core/profiles/demo_umami/themes/umami/templates/classy/layout/html.html.twig
  2. 9 core/themes/olivero/templates/layout/html.html.twig
  3. 9 core/themes/stable9/templates/layout/html.html.twig
  4. 9 core/themes/seven/templates/classy/layout/html.html.twig
  5. 9 core/themes/claro/templates/classy/layout/html.html.twig
  6. 9 core/themes/bartik/templates/classy/layout/html.html.twig
  7. 9 core/themes/stable/templates/layout/html.html.twig
  8. 9 core/themes/starterkit_theme/templates/layout/html.html.twig
  9. 9 core/themes/classy/templates/layout/html.html.twig
  10. 9 core/modules/system/templates/html.html.twig
  11. 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/layout/html.html.twig
  12. 8.9.x core/themes/seven/templates/classy/layout/html.html.twig
  13. 8.9.x core/themes/claro/templates/classy/layout/html.html.twig
  14. 8.9.x core/themes/bartik/templates/classy/layout/html.html.twig
  15. 8.9.x core/themes/stable/templates/layout/html.html.twig
  16. 8.9.x core/themes/classy/templates/layout/html.html.twig
  17. 8.9.x core/modules/system/templates/html.html.twig
  18. 11.x core/profiles/demo_umami/themes/umami/templates/classy/layout/html.html.twig
  19. 11.x core/themes/olivero/templates/layout/html.html.twig
  20. 11.x core/themes/stable9/templates/layout/html.html.twig
  21. 11.x core/themes/claro/templates/classy/layout/html.html.twig
  22. 11.x core/themes/starterkit_theme/templates/layout/html.html.twig
  23. 11.x core/modules/system/templates/html.html.twig

Theme override for the basic structure of a single Drupal page.

Variables:

  • logged_in: A flag indicating if user is logged in.
  • root_path: The root path of the current page (e.g., node, admin, user).
  • node_type: The content type for the current node, if the page is a node.
  • head_title: List of text elements that make up the head_title variable. May contain one or more of the following:

    • title: The title of the page.
    • name: The name of the site.
    • slogan: The slogan of the site.
  • page_top: Initial rendered markup. This should be printed before 'page'.
  • page: The rendered page markup.
  • page_bottom: Closing rendered markup. This variable should be printed after 'page'.
  • db_offline: A flag indicating if the database is offline.
  • placeholder_token: The token for generating head, css, js and js-bottom placeholders.
  • olivero_path: Returns the path to an Olivero theme.
  • noscript_styles: <noscript> content.

See also

template_preprocess_html()

1 theme call to html.html.twig
Html::getInfo in core/lib/Drupal/Core/Render/Element/Html.php
Returns the element properties for this element.

File

core/themes/olivero/templates/layout/html.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for the basic structure of a single Drupal page.
  5. *
  6. * Variables:
  7. * - logged_in: A flag indicating if user is logged in.
  8. * - root_path: The root path of the current page (e.g., node, admin, user).
  9. * - node_type: The content type for the current node, if the page is a node.
  10. * - head_title: List of text elements that make up the head_title variable.
  11. * May contain one or more of the following:
  12. * - title: The title of the page.
  13. * - name: The name of the site.
  14. * - slogan: The slogan of the site.
  15. * - page_top: Initial rendered markup. This should be printed before 'page'.
  16. * - page: The rendered page markup.
  17. * - page_bottom: Closing rendered markup. This variable should be printed after
  18. * 'page'.
  19. * - db_offline: A flag indicating if the database is offline.
  20. * - placeholder_token: The token for generating head, css, js and js-bottom
  21. * placeholders.
  22. * - olivero_path: Returns the path to an Olivero theme.
  23. * - noscript_styles: <noscript> content.
  24. *
  25. * @see template_preprocess_html()
  26. */
  27. #}
  28. {%
  29. set body_classes = [
  30. logged_in ? 'user-logged-in',
  31. not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class,
  32. node_type ? 'page-node-type-' ~ node_type|clean_class,
  33. db_offline ? 'db-offline',
  34. ]
  35. %}
  36. <!DOCTYPE html>
  37. <html{{ html_attributes }}>
  38. <head>
  39. <head-placeholder token="{{ placeholder_token }}">
  40. <title>{{ head_title|safe_join(' | ') }}</title>
  41. <css-placeholder token="{{ placeholder_token }}">
  42. <js-placeholder token="{{ placeholder_token }}">
  43. {% include '@olivero/includes/preload.twig' with {olivero_path: olivero_path} only %}
  44. {{ noscript_styles }}
  45. </head>
  46. <body{{ attributes.addClass(body_classes) }}>
  47. {#
  48. Keyboard navigation/accessibility link to main content section in
  49. page.html.twig.
  50. #}
  51. <a href="#main-content" class="visually-hidden focusable skip-link">
  52. {{ 'Skip to main content'|t }}
  53. </a>
  54. {{ page_top }}
  55. {{ page }}
  56. {{ page_bottom }}
  57. <js-bottom-placeholder token="{{ placeholder_token }}">
  58. </body>
  59. </html>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.