View soure for "an ssg written in shell" [sw gem] from 2026-01-18 in ssg, sw, web, shell.Notes on writing this site's new, mildly cursed, and fun static site generator in (mostly) POSIX shell. Inside a small POSIX SSG Earlier last year, I made this website into a JS single-page application that used two GitHub repos and did regex crimes while praying JavaScript and cross-origin resource-sharing were enabled, and it worked the way a shopping cart with two wheels still rolls downhill… So, after a few months of making and breaking different static site generators and website layouts, I’ve replaced it with a POSIX shell script (with an optional comrak dependency for markdown), because I enjoy cobbling HTML together and don’t want big JS frameworks for my small and simple site. Please welcome: my very site-specific build script, a whole lot of string concatenation! Here’s gen.sh, a static-site-generating script written in shell to turn a directory of markdown files and other resources into a complete blog website with tags, RSS, Atom, and JSON feeds, a sitemap, drafts, and more. What do? gen.sh builds my static site. It’s the website you’re reading from right now. It’s built from handwritten HTML and CSS which the script pieces together, and the posts are written in markdown which it renders to HTML. gen.sh expects: posts/ directory, holding markdown; include/, holding any other assets to be copied into the website’s root, and template/, containing the templates for pages and feeds, which the script will fill. gen.sh builds its output into public/, and is a (mostly) one-pass generator. Here’s what it does, in order: it copies include and posts into public, reads markdown from posts/*.md, extracts metadata from frontmatter, renders content using comrak with extensions, and emits: per-post index.html pages into public/posts/, an index, a page for tags, a page for drafts, and multiple feeds and a sitemap It does not keep a build cache – there is no incremental rebuild. Ther...
First seen: 2026-01-26 06:56
Last seen: 2026-01-26 08:57