Skip to content

Regions and the table of contents - #69

Merged
StfBauer merged 3 commits into
mainfrom
feat/regions
Nov 16, 2026
Merged

StfBauer merged 3 commits into
mainfrom
feat/regions

Conversation

@StfBauer

Copy link
Copy Markdown
Contributor

0.5.0 step 6: regions.

  • A layout declares regions on page.regions ("x-pd-regions": ["sidebar"]) and writes each as {{{page.regions.sidebar}}}, null when the page puts nothing there. <body data-pd-regions="sidebar"> names the filled ones, so a skin's grid collapses an empty region without :has().
  • Components go into a region by region="sidebar" on the pd- tag, or their schema's "x-pd-region", in the page's order, each still checked against its schema. Another layout's region: left out, no message. A region no layout has: the page stops with a "did you mean".
  • Reserved landmarks: header, footer, nav, main are the layout's own (one list). A layout declaring one, or a tag or default region naming one, stops the page; a component in a region can't bring a main, banner or contentinfo.
  • The table of contents is the skin's components/toc (items: [{ text, href, level }]). toc: true (now a reserved key) or a layout's x-pd-toc places the derived one (headings of level 2 and 3) first in its region; toc: false keeps it out. <pd-toc> places it in the markdown, with the derived items or a list of links of its own; its #anchors must be headings of the page, checked after the final render (a suffixed anchor counts).
  • Bench and starter: a doc layout with a sidebar grid that collapses; a page with toc: true, one with <pd-toc> and custom links, one with neither.

Tests: unit (regions, resolution, landmarks, TOC, links), bench E2E in dev and static (the computed grid and boxes at 1000 and 390 px), starter spec. Golden G0 unchanged.

A layout declares regions on page.regions (x-pd-regions) and writes each
as {{{page.regions.<name>}}}, null when empty. A placed component goes
into one by region="..." on its tag or its schema's x-pd-region, in the
page's order; another layout's region is left out, an unknown one stops
the page with a did-you-mean. <body data-pd-regions> names the filled
regions. header, footer, nav and main stay the layout's own landmarks,
and a region's content can't bring one. The table of contents is the
skin's components/toc: toc: true or a layout's x-pd-toc places the
derived one, <pd-toc> places it in the markdown with derived or its own
links, whose anchors must be headings of the page.
@StfBauer
StfBauer merged commit aca421f into main Nov 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant