Creating our HTML wrapper
In order to start addressing the markup of our homepage, we need to look at creating our first Twig template. The html.html.twig
template is a little different than most templates, as it contains the basic structure or wrapper for a Drupal page that the rest of our templates will inherit. This template contains your standard HTML5 markup containing html
, head
, title
, and body
elements along with any other variables that Drupal 8 needs to output content.
We can begin by navigating to core/modules/system/templates
and copying the html.html.twig
Twig template to our themes/octo/templates
folder. One thing to keep in mind as we start working with the Twig templates is that we will always copy a template from core to our themes folder to ensure that we don't accidentally modify any core files.
Next, we can open html.html.twig
and review the markup in our editor. We have the following code:
<!DOCTYPE html> <html{{ html_attributes }}> <head> <head...