Zig 0.16 static-site builder. Reads a content tree, writes a public tree. The engine behind sunlitmoon.online; reusable on any blog tree with the same content layout.
Given $BLOG_ROOT/content/, the builder writes to $BLOG_ROOT/public/:
posts/<slug>.htmlper-post page wrapped in the site frameposts/<slug>.crosspost.txtX / LinkedIn / elevator snippetsessays.htmlindex of all posts (newest first)feed.xmlRSS 2.0 with full textsitemap.xmlfor crawlerslab/,objects/,workshop/,canon/,substrate/section trees
Two source kinds share one rendering pipeline:
- Markdown (
.md) with YAML frontmatter (---block). Body covers headers, paragraphs, bold/italic/inline code, fenced code (with language tag),[link](url), bare URLs,-and1.lists, blockquotes,---HR,images,---> en-dash,----> em-dash. - Hand-curated HTML (
.html) with frontmatter as an HTML comment (<!-- title: ... -->). The body is bare markup; the same site frame wraps it.
Recognized frontmatter keys: title, date, summary, tags, status,
lane, latest_tag, test_count, license, forgejo_url, mirror_url.
The substrate-section keys drive /substrate/ cards and per-project pages.
Substrate lanes (fm.lane): inference, validation, comms, editor,
integration, research.
| Env var | Default | Purpose |
|---|---|---|
BLOG_ROOT |
$HOME/blog |
Project root containing content/ and public/ |
BLOG_SITE_URL |
https://example.invalid |
Canonical base URL for RSS / sitemap / crosspost |
BLOG_TODAY |
system date | Override "today" for deterministic date filters |
CLI flags override env: --root <path>, --site-url <url>, --force.
zig build # build executable into zig-out/bin/blog-build
zig build run # build and run against $BLOG_ROOT
zig build test # unit tests for the markdown libraryInstall:
zig build install --prefix ~/.local
~/.local/bin/blog-buildThis repo is the canonical extraction of the builder that lived in two working trees during pre-1.0:
~/Work/lab/blog-builder/original local scratch~/blog/tools/blog-builder/vendored copy for CI self-containment
The vendored copy received the /substrate/ route plus extended
frontmatter (renderSubstrateIndex, renderSubstrateEntry,
substrate_lanes) during the blog substrate-route work. v0.1.0 here is
that vendored tree promoted to its own sovereign repo. Both consumers
now pull this repo as a git submodule.
Apache-2.0. See LICENSE.
The publish gate compares YYYY-MM-DD calendar days. A post dated 2026-11-12T00:00:00Z publishes on 2026-11-12; its time suffix no longer makes it look like tomorrow. Future days stay out of the public build; drafts retain their existing unlisted-URL behavior. --preview keeps future output under public/preview/. BLOG_TODAY provides a deterministic day override. Supply UTC dates: the calendar ignores timestamp time/offset suffixes and is not an instant-level scheduler. The CLI's library date gate is covered by zig build test; tools/check_calendar.py checks the actual output.