The page shell as a set of slots the host fills (SPEC §13): :lang,
:title, :head, :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. The config's :scripts and its plugins' (since 0.25.0)
are a deferred <script> each, under the request's nonce, after htmx and nav.js, on
every page: a page arrives as often swapped in as loaded whole, and a swap never runs
a <head>, so no page has scripts of its own (since 0.31.0). A <script> the host
writes into :head itself needs its own nonce. With the config's :asset-manifest
(since 0.31.0) the shell links two files in their place — every stylesheet joined in one,
every script in another, each with its integrity — as a release build wrote them.
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`, `: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. The config's `:scripts` and its plugins' (since 0.25.0) are a deferred `<script>` each, under the request's nonce, after htmx and nav.js, on every page: a page arrives as often swapped in as loaded whole, and a swap never runs a `<head>`, so no page has scripts of its own (since 0.31.0). A `<script>` the host writes into `:head` itself needs its own `nonce`. With the config's `:asset-manifest` (since 0.31.0) the shell links two files in their place — every stylesheet joined in one, every script in another, each with its `integrity` — as a release build wrote them. 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.
(linked stylesheets scripts)What a page links, in order, given the config's stylesheets and scripts (its plugins'
among them): {:css [...] :js [...]} — the base's stylesheet before them all, htmx and
nav.js before every script, each once. A release build joins exactly these.
What a page links, in order, given the config's stylesheets and scripts (its plugins'
among them): `{:css [...] :js [...]}` — the base's stylesheet before them all, htmx and
nav.js before every script, each once. A release build joins exactly these.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 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 |