
The Static Site Churns!
The Static Site Churns! êŽë š
I often refer to my scuffed static site generator but what is it?
Itâs a hodgepodge of scripts honed over years, or pilfered from GitHub last week, that glue together my website. As of this weekend it now includes Hono too.
Yeah, I refactored again đ The self-inflicted JavaScript churn continues! Previously I achieved super fast builds using my own experimental just-in-time Svelte templates and URL pattern router. I then went down the HTML parsing and markdown rendering rabbit hole. Eventually I coded my own libraries for both.
I could just use 11ty or Astro but whereâs the fun in that?
â ïž Disclaimer
This is my personal website. I do not write such ludicrous and convoluted code elsewhere (mostwhere). Much of my day work is good olâ LAMP stack[1].
From markdown to markup
My website starts life as a humble collection of markdown[2] files with front matter. These get parsed into JSON[3] with the main body converted to HTML. That process takes around a second. Most of that time is syntax highlighting. I call the output the âmanifestâ.
Hono matches requests against patterns like my blog:
const pattern = "/:year{\\d+}/:month{\\d+}/:day{\\d+}/:slug/";
That particular structure is a relic of WordPress.
Hono consults the manifest for content. It calls my Hypermore template engine to render a HTML document. This runs as a live web server âin developmentâ aka Dev Modeâą. For that I still use Deno
but with Hono my runtime dependency is reducing.To generate a static build I iterate over the manifest and fetch each page writing it back to disk. The build process takes around four seconds. Disk I/O is the bottleneck. There is a Hono SSG helper but I prefer full control.
I have another script to generate open graph images. Another script to generate a static search index. That last link is already outdated. Iâve since written my own Zig[4]and WebAssembly[5] search index (Iâm still drafting the blog post).
Deployment
After moving to Bunny CDN[6] I no longer use a GitHub Action for deployment. I hacked together yet another script to ârawdogâ their API, so to speak, that compares SHA-256 checksums and uploads or deletes files as necessary to sync my local build. This negates my self-hosted action idea to the delight of my weekends.
Is it ever done?
My static site generator has seen countless iterations since 2014. Not to mention the redesigns that give me an excuse. Wait, what year is it now? Good lord, thatâs over a decade!
I just like fooling around with JavaScript and recently, Zig. Every new addition improves my website and teaches me a new trick (for better, or worse). Switching to Hono forced me to clean up my codebase. Iâm technical debt free! For now, Zine (kristoff-it/zine) is giving me ideasâŠ
Codeâs in Git if you can make sense of it. It wonât run for you. The data submodule is private to protect against LLMs. Images are in private large file storage too.
Sources on 'LAMP'(1)
Sources on 'Markdown'(2)
Sources on 'Zig'
Sources on 'WebAssembly (Wasm)'
Sources on 'Bunny'
Linux, Apache, MySQL, and PHP. The way websites were meant to be served until we ruined it. â©ïž
A
simpleplain text markup language created by John Gruber and bastardised by everyone else. Designed for writers who enjoy teeny-weeny font sizes. â©ïžJavaScript Object Notation. An almost perfect specification. If only theyâd allowed trailing commas. â©ïž
A low-level programming language with no hidden control flow and no hidden memory allocations. â©ïž
Low-level machine code for web browsers. Wasm binary instructions are run in a virtual machine. â©ïž
A global content delivery network based in the EU. Ideal for hosting static websites if you find Cloudflare too passĂ©. â©ïž
