Skip to content

Layouts

A layout file wraps every Page in its folder and below with shared Components, such as navigation and a footer.

A layout.mdx file wraps every Page in its folder and below. It holds the parts every Page shares, such as navigation and a footer.

  • sites/www/
  • layout.mdxwraps every Page
  • blog/layout.mdxwraps the blog Pages, inside the root layout

Reference

MDX with one <Slot />, where the Page renders. Layouts nest from the root down.

KeyTypeHolds
themepathA Theme for this subtree
bannerstringA line shown above every Page below

Examples

Minimal

sites/www/layout.mdx
<Slot />

Leaseline

sites/www/layout.mdx
<Navigation />
<Slot />
<CallToAction heading="Start a 14-day trial" action="/checkout/pro" />
<Footer />

What it builds

The SiteBuilder applies the layout to each Page below at compile time.

  • no record of its own; each Page carries its resolved layout
  • a layout change republishes every Page below it with the next Site.publish

Good to know

  • A (group) folder holds its own layout without adding a URL segment; see route segments.