Theming

Exercise: Override the Main Page Template for Drupal 8, 9, 10, and 11

Last updated
Categories
Up-to-date with minor version
11.0.x

In order to change Drupal's default markup you need to override template files. The page template controls the overall layout of your theme, including the placement of regions. You should practice the exercise following the written instructions below. Use the video walk-through to help if you get stuck.

In this exercise, we'll:

  • Override the currently used page.html.twig template file.
  • Modify the content of the file to include the regions defined in the theme's .info.yml file.
  • Wrap the regions in the page template file with HTML markup using CSS classes from Bootstrap to achieve the example layout.

By the end of this tutorial, you'll gain practice creating a custom layout in a page template file.