Question

I'm fairly new to drupal and this is my first time posting on stackexchange. Constructive critisism and feedback are more than welcome.

All regions in my custom theme are placed inside the body tag from html.html.twig file. Is there any way to create a region that is located underneath the body?

The markup should look something like this:

<header>header region block(s)</header>
<body>...</body>
<footer>footer region block(s)</footer>

Right now the way it's rendered it looks like this:

<body>
 <header>header region block(s)</header>
  ...
 <footer>footer region block(s)</footer>
</body>

I'm on drupal 8.6. Thanks in advance, Geordi

Was it helpful?

Solution

Best practice dictates that you should not put the header or footer outside of the body tag. All visible content on your site goes inside the body tag.

Correct HTML syntax looks like this (here is a basic example):

<head>
  <title>My Drupal site</title>
  <!-- Other metadata goes here -->
</head>
<body>
  <header>
    <!-- Top of the page content goes here -->
  </header>
  <section>
    <!-- Main body content goes here -->
  </section>
  <footer>
    <!-- Footer content goes here -->
  </footer>
</body>

See this page for some extra details https://www.w3schools.com/html/html5_semantic_elements.asp

I know this doesn't technically anwer your question, but I feel this is a "correct" response in regards to what information will be most helpful.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top