2

I have the following regions set up in my *.info.yml file:

name: Test
type: theme
description: 'Theme'
base theme: stable
core: 8.x
regions:
  header: 'Header'
  content: 'Content'
  footer: 'Footer'
libraries-override:
  system/base: false

In page--front.html.twig, I placed {{ page.header }} where I wanted the header to be, and noticed via Twig Debugging that Drupal was expecting a file named region--header.html.twig. Great!

So, similarly, I did this for the footer.

{{ page.footer }} and region--footer.html.twig ... but it does not work! Twig Debug's comments do not reveal any hook for the footer at all.

What am I doing wrong?

  • Are there any blocks in the footer? The region won't be rendered if not – Clive Jul 3 '17 at 17:43
  • Hmm.. I am not sure. How would I check? – Raphael Rafatpanah Jul 3 '17 at 17:44
  • 1
    Pop to the block layout page (/admin/structure/block) - if it says No blocks in this region under Footer, that's the problem :) – Clive Jul 3 '17 at 17:50
  • That's what it is. Thank you. Can you formally answer this question so it won't be unanswered? – Raphael Rafatpanah Jul 3 '17 at 17:51
  • Welcome and done! – Clive Jul 3 '17 at 18:03
3

Regions are only rendered by default if they contain blocks (of which at least one must have content).

You can check whether the Footer region has blocks assigned to it by visiting the Block Layout admin page at /admin/structure/block. If you see the No blocks in this region message under the Footer block, you know that's the problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.