JS virtual modules
When you bundle JavaScript (output { assets { bundle #true } }), baudelaire serves the site’s build data as baudelaire:* modules. Import one and rolldown inlines the data into your bundle, so there is no runtime fetch and nothing to keep in sync by hand.
import site from "baudelaire:site";
import { url } from "baudelaire:assets";
document.title = site.title;
loadLogo(url("/assets/logo.png")); // the fingerprinted name
Every module has a default export. When the data is an object, each key is also a named export, so import { title } from "baudelaire:site" pulls in just that one.
The modules
baudelaire:sitetitle,url,lang,author, andversion, the values templates also read fromsys.inputs.baudelaire. See build context.baudelaire:config- your own constants, from the
clientblock below. baudelaire:assets- the map from a request path to its fingerprinted URL, and a
url(path)helper that returns the hashed name (or the path unchanged if it is not a known asset). Use it to point at a hashed asset from script code. baudelaire:pages- the content pages, each as
{ url, title,.
collection, date, taxonomies } baudelaire:sections- the collections, grouped as
{ id, pages: [...], what templates get as
}page.sections. baudelaire:taxonomies- each taxonomy’s terms mapped to the pages that carry them, e.g.
{ tags: { rust: [{ url, title }], .. } }, for tag filtering or a term cloud. baudelaire:feed- the most recent dated pages as
{ url, title, date, newest first, for a “latest posts” widget.
} baudelaire:search- the search-palette client. See search.
Client constants
The client block passes values through to baudelaire:config. Any KDL scalar works:
client {
analytics "https://plausible.io"
revalidate 3600
beta #false
}
import { analytics, revalidate } from "baudelaire:config";
Use it for settings you would otherwise hard-code, or read from the environment at runtime. The same constants reach templates at sys.inputs.baudelaire.client, so server-side Typst and client-side JavaScript read one source.
NOTE
Abaudelaire:assets import sees every image, stylesheet, and copied asset, because scripts are bundled last, once the fingerprint map is done. One bundle cannot see another bundle’s hashed name.