Sections and Sidebars

Pages are composed from sections in Site & Content › Pages (see Content & i18n); the sample-sections sample adds a theme-defined section type.

A section is an operator-composable block with a settings schema. A page is an ordered list of sections. A sidebar is a part area filled with a section list. The host renders the standard section types; a theme may replace their look and add section types of its own.

Section types

The host defines 24 section types, each with its settings schema in HOST_SECTION_SCHEMAS (src/themes/sections.ts):

PlacementTypes
Pagehero, rich-text, html, image, video, button, cta, columns, divider, spacer, alert, accordion, promo-rail, feature-grid, stats-bar, live-tables, upcoming-tournaments, leaderboard
Sidebarsidebar.menu, sidebar.text, sidebar.image, sidebar.promo, sidebar.live-tables, sidebar.upcoming-tournaments

default renders every one of them (client/src/core/theme/sections/host-sections.tsx). A theme may define its own, namespaced theme.<slug>.<type>, each with its own schema.

The video section plays uploaded or same-origin files only, and renders a link card for third-party hosts, because the content security policy does not allow frames or remote media. html sections and rich text are sanitised on the server when the page is saved and again on the client when it renders.

How a section is registered

A theme section type is declared in the manifest with its schema and registered in defineTheme with its component. From sample-sections:

"sections": [
  {
    "type": "theme.sample-sections.callout",
    "schema": {
      "label": "Callout",
      "description": "A headed box with one line of text.",
      "placements": ["page"],
      "fields": [
        { "id": "heading", "type": "text", "label": "Heading", "default": "Seats are open" },
        { "id": "body", "type": "textarea", "label": "Text", "default": "Pick a table in the lobby and sit down." }
      ]
    }
  }
]
defineTheme({
  slug: 'sample-sections',
  sections: {
    'theme.sample-sections.callout': { component: () => import('./sections/callout') },
  },
});

The component receives { section, settings, placement } (SectionComponentProps from @pe/sdk): the stored instance, its settings already coerced to the schema’s field types, and page or sidebar. Fields use the same vocabulary as theme settings (text, textarea, number, range, toggle, select, color, image; see Settings and Customise). A theme type must carry a schema and a host type must not (manifest.section-schema).

While the theme is the active site theme, the page editor (Site & Content › Pages) offers its types after the host’s: GET /api/v1/admin/pages/section-schemas appends the theme.* schemas of the active theme and its parents (a child’s schema replaces its parent’s). An operator can add them and edit saved ones with a form built from the schema. A type declared without a schema is not offered.

Each section renders inside the theme error boundary, so bad data or a throwing component never takes a page down.

A theme template places a list of sections with the SDK’s <Sections sections={[…]} />, which renders through the host’s section renderer; sample-sections places its callout on its own front page that way.

<Sections> takes an optional placement, passed to every section in the list: "page" (the default) or "sidebar". A template that renders a sidebar list passes placement="sidebar", so each section gets the same placement it gets in the host’s own sidebars and can switch to its compact layout:

<Sections sections={list} placement="sidebar" className="my-stack" />

Without it a sidebar list renders with placement="page". A section that renders a nested list of its own (a lobby preview, say) should pass its own placement on. Hosts that predate the prop ignore it and render "page".

Default section lists

sections/*.json in the archive holds a theme’s default section lists per page and sidebar. The server reads them when the theme is the active one (or previewed, or a player’s choice) and sends them with the theme configuration (sectionDefaults); a child’s list replaces its parent’s for the same key.

Each file is either a bare list, keyed by the file name, or a { "pages": { … }, "sidebars": { … } } document with several:

File (or key)Used for
<slug>.json, for example about.jsonThe CMS page with that slug
home.json or site.home.jsonThe front page (the Front page switch in the page editor, Site & Content › Pages)
site.page.<template>.json, then site.page.jsonAny page on that template, then any page
site.sidebar.primary.json, site.sidebar.secondary.jsonThat sidebar, wherever it has no entries of its own

A page lookup tries those keys in that order. A default is used only where the page has no section list of its own (a page that never had sections); a list the operator saved, even an empty one, always wins, and a sidebar uses the default only while neither the page nor the site-wide sidebar has entries. Lists go through the same checks and HTML sanitiser as a page the operator saves; a file or list that fails them is skipped and logged, never served. sample-sections ships home.json: its callout appears on the front page while the theme is active. Operators’ edits are stored with the page and are never overwritten by a theme.

Page templates

Six standard page templates exist. Each CMS page picks one in its editor.

Template idShape
defaultTitle, content and sections in a centred container
full-widthContent across the full width
sidebar-leftThe page beside a sidebar at the start of the row
sidebar-rightThe page beside a sidebar at the end of the row
landingSections only, edge to edge, no title
blankSections and content with no title and no container

A theme provides a template for site.page.<template> or lets it fall back to site.page. default provides all six (client/src/core/theme/sections/PageTemplates.tsx).

Two sidebars exist: site.sidebar.primary and site.sidebar.secondary. The sidebar-left and sidebar-right page templates show them. Their site-wide lists are set through the /admin/appearance/sidebars API (the Customise page does not edit them yet); a page may replace either list in its own editor. A theme fills the area like any part area, and receives the list as the sections prop; a theme template that renders that list itself uses <Sections sections={list} placement="sidebar" /> (see above).

The front page

The front page is the view id site.home. With appearance enabled, an operator can show a CMS page at / to visitors who are not signed in (Use as front page in the page editor). A theme that registers site.home replaces the front page itself. The redirect that sends a signed-in player to the lobby stays in the host.

Merge tags in section text

Text fields with mergeTags: true in their schema may contain merge tags. See Strings and Merge Tags for what is resolved today.

Try the live demo Pricing

Have questions about Poker Engine? We reply fast.