smelt
A static site generator that builds this site. Written from scratch in Go as a learning project to learn some of the advancements of modern golang.
Why
I wanted to clean out some cobwebs on my Go knowledge by building something real. I didn't want to build a tutorial project in a folder that never does anything. Something with actual users (even if the user is mostly me), actual deploys, and actual bugs to fix.
Also, something reasonable, that would help me. Personal tools are important.
Most SSGs do too much, and specifically too much of things I don't need. On the other hand, this is one that does exactly what I need. And I can extend it to do more of "what I need" when I need to. I wanted one that does exactly what I need and nothing else. TOML frontmatter, markdown, templates, done.
What it does
- Parses garden notes and project pages from markdown with TOML frontmatter
- Renders HTML with Go's
html/template - Wikilinks with [[slug]] and [[slug|display text]] syntax
- Backlinks computed at build time
- Concurrent page rendering with
errgroup - SVG sparklines for traffic stats
- Dev server with file watching and auto-rebuild
- Nginx log parsing for a privacy-first stats page
- Templates embedded in the binary with
go:embed - Structured logging with
slog
Stack
Go. That's it. Dependencies: goldmark (markdown), toml, fsnotify (file watching), errgroup (concurrency). No frameworks, no JS build step, no React, no bullshit.
Deployed with punt (more on this later) via blue/green Docker deploys to a
cheap VPS.
Learned
go -racefor validating / finding concurrency bugserrgroupslogfor structured logging in golanggo:embedfor embedding things into a single binary, newish in the 1.21ish Golang era
Related garden notes
How this garden works
Why this site is a garden, not a blog. How to navigate it.
Software Convictions, Mostly Earned.
Hard-won beliefs about software, teams, and systems. None started as convictions. They started as mistakes.