Files
lotherk 3eae0cc954 build: vendor bb static site generator
Vendor the C99 bb sources, share directory, tests and man page under third_party/bb (MIT, upstream f5373fb) and add a make bb target. A checkout can now build project sites without an installed bb.

Assisted-by: OpenCode:DeepSeek-V4.1-Flash
2026-11-22 12:27:43 +00:00

3.7 KiB

bb

A content-first static site generator written in pure C99 + POSIX /bin/sh. Write Markdown, run make, get a complete static site. No framework, no JavaScript in the output, no runtime backend. Developed on Linux against C99 and POSIX; the output is plain HTML 4.01 and reads fine in lynx.

bb was written together with an AI (Claude). I steered and tested, the model wrote most of the code.

Why

bb does one thing: turn Markdown into a static site. The layout is a plain /bin/sh script, so there is no template engine to learn. The output is HTML 4.01 with one stylesheet.

Build

make            # builds ./bb
make install    # installs to /usr/local (override: make PREFIX=/usr)

Requires a C99 compiler and POSIX make. No external dependencies.

Quick start

bb init my-site
cd my-site
make            # builds into dist/
lynx dist/index.html

bb init scaffolds a project with site.conf, pages/, posts/, and a Makefile. make runs bb build with the default theme.

Usage

bb init [dir]          Scaffold a new project
bb new post "Title"    Create a new blog post (opens $EDITOR if set)
bb new page "Title"    Create a new page (opens $EDITOR if set)
bb build [--theme N]   Build current project into dist/
bb serve [--port N]    Preview dist/ at http://127.0.0.1:8000/
bb theme check         Report theme contrast problems

Project structure

my-site/
  site.conf        # site title, description, optional font
  pages/           # pages (index.md -> /, about.md -> /about/)
  posts/           # blog posts (YYYY-MM-DD-slug.md)
  overlay/         # optional: files copied verbatim into dist/
  pages.de/        # optional: translations, built into dist/de/
  posts.pt/        # optional: translated posts, built into dist/pt/blog/
  Makefile         # runs bb build
  dist/            # output (generated, wiped on every build)

Pages opt into the nav bar with menu: true, menuLabel and menuOrder in their frontmatter. overlay/ is for images, robots.txt, a favicon: anything that must survive dist/ being rebuilt from scratch. See man bb for the details of i18n and the templating helpers.

Layouts

The layout is a POSIX /bin/sh script at share/layouts/layout.sh. BB sources share/bb/lib/bb.sh transparently before running it, so the bb_* helpers are always available — and the layout can override them.

See the Templating Library docs for bb_nav, bb_content, bb_each_post, bb_each_page, and more.

Themes

A theme is a small file of design tokens (bg, text, link, heading, ... plus frame = bevel for raised/sunken Motif and Windows 95 looks) in share/themes/*.conf. Pick one with make THEME=breeze or bb build --theme breeze. Only bg is required; the rest is derived.

bb makes every theme readable: colours are moved towards black or white until they reach WCAG AA contrast, so imported palettes cannot produce unreadable pages. bb theme check shows what it changed.

70+ themes ship, imported from real desktop toolkits with the scripts in scripts/ (CDE .dp, KDE .colors, GTK2 gtk-color-scheme), plus oli7, the one custom theme, extracted from a photo of Konrad's son and wife. See man bb (THEME FORMAT) for the full token list.

Fonts

Set font = monospace (or sans, serif) in site.conf to bundle a font from share/fonts/ into dist/assets/fonts/ and emit @font-face CSS. If unset, the OS default is used.

Install layout

make install copies the binary to $(PREFIX)/bin and the layouts, themes, fonts, and lib/bb.sh to $(PREFIX)/share/bb. The binary finds its share dir via the compiled-in BB_SHAREDIR (default /usr/local/share/bb), falling back to ./share in the source tree.

License

MIT.