The documentation site of the temples packages — built with temples itself.
content/**/*.md ──Bun.markdown──▶ HTML fragments
│
layout.html ──@temples/ssr prepare()─▶ www/<slug>.html + www/assets/style.css
content/**/*.md ──link rewrite──────▶ www/<slug>.md (plain-text counterpart)
│
└──▶ www/llms.txt (agent index, links the .md files)
content/*.md— one file per page. The front-matter block carriestitle,description, andorder(nav ordering). A page withhidden: trueis built but stays out of the navigation, the markdown exports, andllms.txt.content/recipes/*.md— a page in a subdirectory is a referenced page: the build renders it and exports its markdown, andllms.txtlists it, but it stays out of the sidebar. A referenced page is reached from another page, such as the "Recipes and good practices" chapter of the components guide.- Links are absolute. An author writes a short relative link (
binding-syntax.html). The build rewrites it to the canonical URL:.htmlin the page, and the.mdtwin in the markdown export. The shell links (stylesheet, home,llms.txt, sidebar) stay relative, so the site renders locally and under any base path. BASE_URLis the canonical origin baked into those absolute links. The workflow sets it to the deployed URL. A build without it falls back tohttps://zipang.github.io/temples. To keep local links local, build withBASE_URL=http://localhost:4173 bun run build:docs.content/404.md— the 404 error page, kept out of the navigation byhidden: true.layout.html— a temples template: the nav iteratessite.pages(data-iterate), the page body is injected withdata-bind="html=page.content". The head declares the markdown export of the page with<link rel="alternate" type="text/markdown">, kept only whiledata-render-if="page.markdownUrl"is truthy — hidden pages carry an emptymarkdownUrl, so they emit no link. It also declares<link rel="describedby" href="llms.txt">, the agent index covering the site, as recommended by llmstxt.org.src/markdown.ts— the only module that touchesBun.markdown(an unstable Bun API), so a parser swap stays a one-file change.src/build.ts— the pipeline.buildSite()is exported for tests; the script runs it when executed directly. It copies every visible page as raw markdown next to its HTML file.src/serve.ts— rebuilds the site with the local origin asBASE_URL, so every absolute link points back at the preview, then serveswww/with a Bun file route for the root and afetchhandler for every other path. When the path does not name a file inwww/, the handler serves404.htmlwith status 404.
Run these commands from inside packages/docs/. The build regenerates www/ completely,
so never edit its files by hand.
bun run build # build the site into www/
bun run serve # rebuild with the local base URL, then serve www/ at http://localhost:4173
bun test # the build has a smoke test (build.test.ts)The site is a plain static output: any static host works, with www/ as the publish directory
and bun install && bun run build:docs as the build command.
- GitHub Pages —
.github/workflows/deploy-docs.ymldeploys on every push tomaster. Pages serves the site under a subpath (/temples/), which the build supports because all asset and page links are relative. Pages also useswww/404.htmlas its error page. - Vercel / Netlify / Cloudflare Pages — create a project pointed at this repository with:
- build command:
bun install && bun run build:docs - output directory:
packages/docs/www
- build command:
- LLM agents — the build emits
www/llms.txt, an index of every page with absolute links to its raw markdown (<slug>.md), so agents fetch plain text instead of HTML.