The page shell as a set of slots the host fills (SPEC §13): :lang,
:title, :head, :scripts, :header, :header-width, :nav, :identity, :aside,
:content, :footer. :header-width (since 0.27.0) is how wide the header stands: :full, the
default, spans the window; :aligned spans it with its content where <main>'s text
starts and ends, never nearer the edge than --wb-gap; :measure is the column the rest
of the page keeps.
:aside (since 0.27.0) stands beside <main> from 48em up, --wb-aside (16rem) wide
against the window's inline-start edge, its content a gap down as <main>'s is, with
<main> centred at its measure in the room left; below 48em it sits above <main>. The
nav, identity, footer and a header held to the column line up with <main>, and an
:aligned header's content with its text. It is outside <main>, so a
wb/link swap keeps it, and /wb/nav.js marks its current link when the links sit in a
data-wb-nav element. It belongs to the layout, as the nav does: a swap keeps the aside of
the page it leaves, so pages that do not share one are linked with a plain <a>.
It is an ordinary layout — a function of one slot map — usable as the
outermost entry of a route's :wb/layouts or called by the host's own
layout. Absent slots emit nothing.
What the shell reads from :request, when the request carries it: the
stylesheets of the config's :stylesheets and its plugins, linked after the base's
own and before :head; the negotiated locale for lang (SPEC §14), the CSP nonce for its own script
tag and the CSRF token, sent on every htmx request as X-CSRF-Token
through hx-headers:inherited on <body> (SPEC §15) — htmx 4 inherits
nothing without the modifier. :scripts — local paths, after the route's own
:wb/scripts — is a deferred <script> each, under the request's nonce (since
0.22.0); a <script> the host writes into :head itself needs its own nonce. The
config's :scripts and its plugins' (since 0.25.0) load before both, on every page:
every page has them in its head, so they never make the page its own, and a
wb/link swap of it stays a swap. Every stylesheet and script the shell links is linked
at its fingerprinted path when the config's :asset-manifest names one (since 0.30.0).
The token goes on <body> only when the page uses it: when the rendered body
carries an htmx attribute (hx-… or data-hx-…), or when its content already
read the token for a form. Reading it is what writes it into the session, so a
page with neither — a public page, crawled — leaves no session behind. The body
is rendered before that decision, so a form or an htmx attribute inside lazy
content counts. What it cannot see is htmx reached from a script
(htmx.ajax, fetch) on a page with neither, or attributes under a prefix the host
configured for htmx in place of data-hx-: such a page puts security/csrf-meta in
:head, which reads the token.
The page shell as a set of slots the host fills (SPEC §13): `:lang`, `:title`, `:head`, `:scripts`, `:header`, `:header-width`, `:nav`, `:identity`, `:aside`, `:content`, `:footer`. `:header-width` (since 0.27.0) is how wide the header stands: `:full`, the default, spans the window; `:aligned` spans it with its content where `<main>`'s text starts and ends, never nearer the edge than `--wb-gap`; `:measure` is the column the rest of the page keeps. `:aside` (since 0.27.0) stands beside `<main>` from 48em up, `--wb-aside` (16rem) wide against the window's inline-start edge, its content a gap down as `<main>`'s is, with `<main>` centred at its measure in the room left; below 48em it sits above `<main>`. The nav, identity, footer and a header held to the column line up with `<main>`, and an `:aligned` header's content with its text. It is outside `<main>`, so a `wb/link` swap keeps it, and /wb/nav.js marks its current link when the links sit in a `data-wb-nav` element. It belongs to the layout, as the nav does: a swap keeps the aside of the page it leaves, so pages that do not share one are linked with a plain `<a>`. It is an ordinary layout — a function of one slot map — usable as the outermost entry of a route's `:wb/layouts` or called by the host's own layout. Absent slots emit nothing. What the shell reads from `:request`, when the request carries it: the stylesheets of the config's `:stylesheets` and its plugins, linked after the base's own and before `:head`; the negotiated locale for `lang` (SPEC §14), the CSP nonce for its own script tag and the CSRF token, sent on every htmx request as `X-CSRF-Token` through `hx-headers:inherited` on `<body>` (SPEC §15) — htmx 4 inherits nothing without the modifier. `:scripts` — local paths, after the route's own `:wb/scripts` — is a deferred `<script>` each, under the request's nonce (since 0.22.0); a `<script>` the host writes into `:head` itself needs its own `nonce`. The config's `:scripts` and its plugins' (since 0.25.0) load before both, on every page: every page has them in its head, so they never make the page its own, and a `wb/link` swap of it stays a swap. Every stylesheet and script the shell links is linked at its fingerprinted path when the config's `:asset-manifest` names one (since 0.30.0). The token goes on `<body>` only when the page uses it: when the rendered body carries an htmx attribute (`hx-…` or `data-hx-…`), or when its content already read the token for a form. Reading it is what writes it into the session, so a page with neither — a public page, crawled — leaves no session behind. The body is rendered before that decision, so a form or an htmx attribute inside lazy content counts. What it cannot see is htmx reached from a script (`htmx.ajax`, `fetch`) on a page with neither, or attributes under a prefix the host configured for htmx in place of `data-hx-`: such a page puts `security/csrf-meta` in `:head`, which reads the token.
The base's own script that moves the focus to <main> after wb/link swaps it.
The base's own script that moves the focus to `<main>` after `wb/link` swaps it.
(page {:keys [lang title head scripts header header-width nav aside content
footer request]
who :identity})cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |