Template variables
Drupal 8 uses variables to output data within Twig templates. We know that variables generally consist of anything from a simple string to a complex object containing an array of values. If we look at the html.html.twig
template, we will see documentation that outlines the variables available to us along with the name of the variable and a description of what the variable contains.
The list of variables is as follows:
logged_in
: A flag indicating whether the user is logged inroot_path
: The root path of the current page (for example, node, admin, and user)node_type
: The content type for the current node, if the page is a nodehead_title
: List of text elements that make up thehead_title
variabletitle
: The title of the pagename
: The name of the siteslogan
: The slogan of the sitepage_top
: Initial rendered markup; this should be printed before pagepage
: The rendered page markuppage_bottom
: Closing rendered markup; this variable should be printed after pagedb_offline
: A flag...