O'Reilly logo

Drupal 8: Enterprise Web Development by Chaz Chumley, Matt Glaman, Richard Jones, Nick Abbott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Twig templates

The easiest way to work with Twig templates is to allow Drupal and the Twig debug settings we enabled earlier to do the entire work for us. So what do I mean? Begin by navigating to the homepage and inspecting the markup using Chrome's developer tools. Locate the section of markup where we see the div element with a class of layout-container, as shown in the following image:

Using Twig templates

Twig debugging allows us to view all the information we need to identify which Twig template we can use for our homepage. If we look at the information provided, we can identify the following:

  • Drupal is currently using page.html.twig
  • The template is located ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required