page.html.twig

Default theme implementation to display a single page.

The doctype, html, head and body tags are not in this template. Instead they can be found in the html.html.twig template in this directory.

Available variables:

General utility variables:

  • base_path: The base URL path of the Drupal installation. Will usually be "/" unless you have installed Drupal in a sub-directory.
  • is_front: A flag indicating if the current page is the front page.
  • logged_in: A flag indicating if the user is registered and signed in.
  • is_admin: A flag indicating if the user has permission to access administration pages.

Site identity:

  • front_page: The URL of the front page. Use this instead of base_path when linking to the front page. This includes the language domain or prefix.
  • logo: The url of the logo image, as defined in theme settings.
  • site_name: The name of the site. This is empty when displaying the site name has been disabled in the theme settings.
  • site_slogan: The slogan of the site. This is empty when displaying the site slogan has been disabled in theme settings.

Navigation:

  • main_menu: The Main menu links for the site, if they have been configured.
  • secondary_menu: The Secondary menu links for the site, if they have been configured.
  • breadcrumb: The breadcrumb trail for the current page.

Page content (in order of occurrence in the default page.html.twig):

  • title_prefix: Additional output populated by modules, intended to be displayed in front of the main title tag that appears in the template.
  • title: The page title, for use in the actual content.
  • title_suffix: Additional output populated by modules, intended to be displayed after the main title tag that appears in the template.
  • messages: Status and error messages. Should be displayed prominently.
  • tabs: Tabs linking to any sub-pages beneath the current page (e.g., the view and edit tabs when displaying a node).
  • action_links: Actions local to the page, such as "Add menu" on the menu administration interface.
  • feed_icons: All feed icons for the current page.
  • node: Fully loaded node, if there is an automatically-loaded node associated with the page and the node ID is the second argument in the page's path (e.g. node/12345 and node/12345/revisions, but not comment/reply/12345).

Regions:

  • page.header: Items for the header region.
  • page.highlighted: Items for the highlighted content region.
  • page.help: Dynamic help text, mostly for admin pages.
  • page.content: The main content of the current page.
  • page.sidebar_first: Items for the first sidebar.
  • page.sidebar_second: Items for the second sidebar.
  • page.footer: Items for the footer region.

See also

template_preprocess()

template_preprocess_page()

template_process()

template_process_page()

html.html.twig

1 theme call to page.html.twig
system_element_info in drupal/core/modules/system/system.module
Implements hook_element_info().

File

drupal/core/modules/system/templates/page.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a single page.
  5. *
  6. * The doctype, html, head and body tags are not in this template. Instead they
  7. * can be found in the html.html.twig template in this directory.
  8. *
  9. * Available variables:
  10. *
  11. * General utility variables:
  12. * - base_path: The base URL path of the Drupal installation. Will usually be
  13. * "/" unless you have installed Drupal in a sub-directory.
  14. * - is_front: A flag indicating if the current page is the front page.
  15. * - logged_in: A flag indicating if the user is registered and signed in.
  16. * - is_admin: A flag indicating if the user has permission to access
  17. * administration pages.
  18. *
  19. * Site identity:
  20. * - front_page: The URL of the front page. Use this instead of base_path when
  21. * linking to the front page. This includes the language domain or prefix.
  22. * - logo: The url of the logo image, as defined in theme settings.
  23. * - site_name: The name of the site. This is empty when displaying the site
  24. * name has been disabled in the theme settings.
  25. * - site_slogan: The slogan of the site. This is empty when displaying the site
  26. * slogan has been disabled in theme settings.
  27. *
  28. * Navigation:
  29. * - main_menu: The Main menu links for the site, if they have been configured.
  30. * - secondary_menu: The Secondary menu links for the site, if they have been
  31. * configured.
  32. * - breadcrumb: The breadcrumb trail for the current page.
  33. *
  34. * Page content (in order of occurrence in the default page.html.twig):
  35. * - title_prefix: Additional output populated by modules, intended to be
  36. * displayed in front of the main title tag that appears in the template.
  37. * - title: The page title, for use in the actual content.
  38. * - title_suffix: Additional output populated by modules, intended to be
  39. * displayed after the main title tag that appears in the template.
  40. * - messages: Status and error messages. Should be displayed prominently.
  41. * - tabs: Tabs linking to any sub-pages beneath the current page (e.g., the
  42. * view and edit tabs when displaying a node).
  43. * - action_links: Actions local to the page, such as "Add menu" on the menu
  44. * administration interface.
  45. * - feed_icons: All feed icons for the current page.
  46. * - node: Fully loaded node, if there is an automatically-loaded node
  47. * associated with the page and the node ID is the second argument in the
  48. * page's path (e.g. node/12345 and node/12345/revisions, but not
  49. * comment/reply/12345).
  50. *
  51. * Regions:
  52. * - page.header: Items for the header region.
  53. * - page.highlighted: Items for the highlighted content region.
  54. * - page.help: Dynamic help text, mostly for admin pages.
  55. * - page.content: The main content of the current page.
  56. * - page.sidebar_first: Items for the first sidebar.
  57. * - page.sidebar_second: Items for the second sidebar.
  58. * - page.footer: Items for the footer region.
  59. *
  60. * @see template_preprocess()
  61. * @see template_preprocess_page()
  62. * @see template_process()
  63. * @see template_process_page()
  64. * @see html.html.twig
  65. *
  66. * @ingroup themeable
  67. */
  68. #}
  69. <div id="page">
  70. <header id="header" role="banner" class="clearfix">
  71. {% if logo %}
  72. <a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home" id="logo">
  73. <img src="{{ logo }}" alt="{{ 'Home'|t }}"/>
  74. </a>
  75. {% endif %}
  76. {% if site_name or site_slogan %}
  77. <div id="name-and-slogan">
  78. {% if site_name %}
  79. {% if title %}
  80. <p id="site-name"><strong>
  81. <a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
  82. </strong></p>
  83. {# Use h1 when the content title is empty #}
  84. {% else %}
  85. <h1 id="site-name">
  86. <a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
  87. </h1>
  88. {% endif %}
  89. {% endif %}
  90. {% if site_slogan %}
  91. <p id="site-slogan">{{ site_slogan }}</p>
  92. {% endif %}
  93. </div><!-- /#name-and-slogan -->
  94. {% endif %}
  95. {{ page.header }}
  96. </header>
  97. {% if main_menu or secondary_menu %}
  98. <nav role="navigation">
  99. {{ main_menu }}
  100. {{ secondary_menu }}
  101. </nav>
  102. {% endif %}
  103. {{ breadcrumb }}
  104. {% if messages %}
  105. <div id="messages">{{ messages }}</div>
  106. {% endif %}
  107. <div id="main" role="main" class="clearfix">
  108. <a id="main-content"></a>
  109. <div id="content" class="column">
  110. {% if page.highlighted %}<div id="highlighted">{{ page.highlighted }}</div>{% endif %}
  111. {{ title_prefix }}
  112. {% if title %}<h1 class="title" id="page-title">{{ title }}</h1>{% endif %}
  113. {{ title_suffix }}
  114. {% if tabs %}<div class="tabs">{{ tabs }}</div>{% endif %}
  115. {{ page.help }}
  116. {% if action_links %}<ul class="action-links">{{ action_links }}</ul>{% endif %}
  117. {{ page.content }}
  118. {{ feed_icons }}
  119. </div><!-- /#content -->
  120. {% if page.sidebar_first %}
  121. <div id="sidebar-first" class="column sidebar">
  122. {{ page.sidebar_first }}
  123. </div><!-- /#sidebar-first -->
  124. {% endif %}
  125. {% if page.sidebar_second %}
  126. <div id="sidebar-second" class="column sidebar">
  127. {{ page.sidebar_second }}
  128. </div><!-- /#sidebar-second -->
  129. {% endif %}
  130. </div><!-- /#main -->
  131. <footer id="footer" role="contentinfo">
  132. {{ page.footer }}
  133. </footer>
  134. </div><!-- /#page -->

Related topics