Structured Sections

Structured Content Sections

Structured sections let you define multiple named content regions within a single markdown file, without needing the directory overhead of modular pages. Each section is independently rendered from markdown to HTML and accessible in templates via page.sections.<name>.

Section Markers

Add ---section: name--- on its own line to start a new named section. Everything before the first marker is the default content (page.content). Section names must be valid identifiers (letters, digits, underscores).

---
title: Landing Page
template: landing
---
# Welcome

This main content appears as page.content.

---section: features---
## Our Features

- Fast performance
- Easy to use

---section: cta---
## Get Started

Sign up now!

Template Usage

Access each section by name:

<main>{{ page.content | safe }}</main>

{% if page.sections.features is defined %}
<section class="features">
  {{ page.sections.features | safe }}
</section>
{% endif %}

{% if page.sections.cta is defined %}
<footer class="cta">
  {{ page.sections.cta | safe }}
</footer>
{% endif %}

Iterate over all sections:

{% for name in page.sections %}
<section class="section-{{ name }}">
  {{ page.sections[name] | safe }}
</section>
{% endfor %}

Key Behaviors

  • page.sections is an empty map for pages without section markers (backward compatible)
  • Each section is independently rendered through the markdown pipeline
  • Regular horizontal rules (---) are not affected – only ---section: name--- is a marker
  • All markdown features work within sections (headings, code blocks, links, lists, etc.)
  • Hot reload correctly invalidates cache when section content changes
  • Empty sections (marker with no content before the next marker) exist in the map as empty strings

Sections vs. Modular Pages

AspectSectionsModular Pages
File structureSingle .md fileMultiple _ directories
OverheadMinimalMedium (directory per module)
Per-section frontmatterNoYes
Per-section custom fieldsNoYes
Per-section orderingOrder of appearancemenu.order in frontmatter
Best forSimple multi-region pagesComplex composable layouts

The default theme includes a landing.html.jinja template that demonstrates sections. Set template: landing in your frontmatter and add section markers.