In Drupal 10 and Drupal 11, regions define the structural placeholders of a page. They act as containers where blocks are placed and rendered. While themes control markup and styling, regions define the structural layout boundaries.
For the Acquia Front End Specialist exam, you must understand:
- How regions are declared
- How Drupal registers them
- How they are rendered
- How blocks flow into regions
- How page.html.twig controls layout structure
- How Layout Builder interacts with regions
This article explains the complete structural flow — from region definition to final HTML output.
1. What Is a Region in Drupal?
A region is a named section of a page that can hold blocks.
Examples:
- header
- primary_menu
- content
- sidebar_first
- footer
Regions are not visible by themselves.
They become visible only when:
- They are declared in .info.yml
- They are printed in page.html.twig
- Blocks are placed inside them
2. Declaring Regions (REQUIRED Step)
Regions are defined inside:
theme_name.info.yml
Example:
regions:
header: Header
primary_menu: Primary Menu
content: Content
sidebar_first: Sidebar First
footer: Footer
Why Drupal uses .info.yml for regions:
- Allows UI block placement system
- Decouples structure from markup
- Enables admin control of layout
Core processing:
Drupal\Core\Extension\ThemeHandler
Drupal reads this file during theme discovery.
3. Rendering Regions in page.html.twig
Declaring regions is not enough.
You must print them inside page.html.twig.
Example:
<header>
{{ page.header }}
</header>
<main>
{{ page.content }}
</main>
<aside>
{{ page.sidebar_first }}
</aside>
<footer>
{{ page.footer }}
</footer>
Important:
page is a render array passed via:
hook_preprocess_page()
If you forget to print a region → blocks assigned to it will not display.
4. How Blocks Flow Into Regions
Block flow architecture:
- Admin assigns block to region via UI
- Block plugin builds render array
- Render array attached to page variable
- page.region_name contains block render arrays
- Twig prints region
Core block system:
core/modules/block/BlockViewBuilder.php
Blocks are plugins.
Regions are placeholders.
5. Conditional Rendering of Regions
Best practice:
{% if page.sidebar_first %}
<aside>
{{ page.sidebar_first }}
</aside>
{% endif %}
Why?
Prevents empty HTML wrappers.
Improves accessibility and clean markup.
Exam trap: Rendering empty region wrappers unnecessarily.
6. Page Layout Hierarchy
Full structure hierarchy:
html.html.twig
→ page.html.twig
→ regions
→ block.html.twig
→ node.html.twig
→ field.html.twig
Understanding this hierarchy is critical for debugging template issues.
7. Interaction with Layout Builder
Layout Builder can override region layout per content type or per node.
Two modes:
- Manage layout for content type
- Allow per-node customization
Layout Builder does NOT remove regions.
It controls block placement inside a layout section.
Core module:
core/modules/layout_builder/
Exam Tip:
Know difference between:
- Theme regions
- Layout Builder sections
They are not the same.
8. Required vs Optional for Regions
| Component | Required | Purpose |
|---|---|---|
| .info.yml regions | YES | Define placeholders |
| page.html.twig print | YES | Render output |
| Conditional logic | Recommended | Clean markup |
| Custom region classes | Optional | Styling |
9. Common Mistakes
❌ Declaring region but not printing it
❌ Hardcoding block content inside Twig
❌ Using static HTML instead of block system
❌ Not checking region existence before rendering
❌ Confusing Layout Builder sections with theme regions
10. Real Project Scenario
Scenario:
Client wants hero banner above content only on homepage.
Correct approach:
- Create region: hero
- Print it above content in page.html.twig
- Place custom block in hero region
- Use visibility condition for front page
Wrong approach:
Hardcoding banner inside template.
Why?
Blocks allow admin flexibility.
11. Interview Questions
- What is the difference between a region and a block in Drupal?
- Where are regions declared?
- Why must regions be printed in page.html.twig?
- How does Layout Builder differ from theme regions?
- Explain how a block render array reaches Twig.
12. Exam-Style Questions
Q1: Where are theme regions defined?
A. libraries.yml
B. page.html.twig
C. theme.info.yml
D. theme.theme
Correct: C
Q2: What happens if a region is declared but not printed in page.html.twig?
A. It throws error
B. It renders automatically
C. Blocks assigned to it will not display
D. It moves to content region
Correct: C
Q3: Which core system manages blocks?
A. Render API
B. Plugin API
C. Block module
D. Layout Builder
Correct: C
13. Quick Cheat Sheet
• Regions declared → info.yml
• Regions printed → page.html.twig
• Blocks placed → Admin UI
• Blocks are plugins
• Layout Builder ≠ theme regions
• Always conditionally render empty regions
Final Thoughts
Regions are the structural backbone of a Drupal theme. Mastering them ensures clean architecture, flexible layouts, and exam readiness.