--- lines at the top of a .slurp file. The
delimiters must be at column 1. Every directive is optional, and so is the block.
The complete list
Directives may appear in any order, and repeated
using, type and props
statements accumulate. A second section { } or a second block { } is an
InvalidFrontmatter error; both may appear in the same file.
using
using "@components/Card" introduces Card, which is what makes <Card />
resolve.
@-prefixed paths are registry keys the host resolves. The CLI resolves
@components/X and @layouts/X against the project directory.
using type
from keyword is required; omitting it is InvalidFrontmatter.
type
props or a {fetch} type hint. A ? marks a field
optional.
Type expressions are stored as raw strings and are never checked, at parse time
or at render time. TypeMismatch is declared in the error enum and never emitted.
The names are for humans and for editor tooling.
props
required
The prop name. A
? immediately after it marks the prop optional.required
A type expression, stored as a raw string. Append
[] for an array.Optional. The expression is evaluated in the caller’s scope when the prop is
not passed.
null. MissingRequiredProp and UnknownProp are
both declared and never emitted; passing a prop the component never declared is not
an error either.
Defaults are evaluated in the caller’s scope
components/Card.slurp
count5 = 5, <Card /> produces
<div>5</div>. The default expression is resolved where the component was written
into the page, not inside the component.
middleware
request.*,
{redirect} and {next} become legal, and the only path roots allowed are
request, env and loop. Reading any other root there is
MiddlewareScopeViolation.
section { } and block { }
These declare a typed editor surface. The grammar is large enough to have its own
page: see Schemas.
section, settings, blocks, name, max and max_per_page are CONTEXTUAL
keywords. They lex as ordinary identifiers and gain meaning only at that exact
structural position, so a template using any of them as a prop name or a type name
is unaffected. A section statement is recognised only when a { follows it
immediately.
env and secrets
env.* is readable from a template, with one hard restriction enforced at compile
time:
A non-constant key is refused because it could resolve to a secret name. Read the
secret on the server and pass only a derived, non-secret value through the render
context.