Go-first static sites
astwerk
A static site generator that is just a Go program. Describe the output directory as a tree, call Build, get HTML. No config, no conventions, no client runtime in core.
go get github.com/LukasDerBaum42/astwerkGet started Documentation Examples
How astwerk thinks · Quick reference
- Go 1.27+
- No Node.js
- No config
- MIT
build/ ├── index.html ├── about/ │ └── index.html ├── style/ └── scripts/
Toggle a node — plain JavaScript, no client runtime.
Design law
Abstract only the repeating boilerplate. If a project needs something the tree can’t express, it falls back to plain Go — never a wall it can’t get past.
The whole mechanism
You describe the output directory as a tree of Nodes and call Build. There is no config file, no convention scanner, no code generation. That is the entire API surface for generating a site.
root := ssg.Node{
Title: "My Site",
Page: ssg.Templ(views.Home),
Children: map[string]ssg.Node{
"docs": {Title: "Docs", Generate: docPages},
"style": {CopyFrom: "style"},
"scripts": {CompileFrom: "scripts"},
},
}
if err := ssg.Build(root, ssg.BuildOptions{Dev: dev}); err != nil {
log.Fatal(err)
}That writes build/index.html, build/docs/index.html, copies style/ in, and compiles scripts/ when a script carries the wasm build constraint.
Core, in six parts
Everything below is in the main module. Add what a site needs; ignore what it doesn’t.
The node tree ssg
One function replaces hand-written page loops and scattered os.MkdirAll calls. Pages get their own path and locale handed to them.
Markdown content content
TOML or JSON front matter decoded into your own struct, with collections and markdown components.
Derived locales BuildLocales
A locale subtree is generated from the base tree. You list only the pages that genuinely differ.
Asset sidecars assets
Pair a directory of images or media with licence and credit metadata from meta.json or meta.toml.
Dev server devserver
Watch, rebuild, reload. The loop you leave running while you work, with the build kept out of process.
Starter templates starter
Thirteen copyable .templ files — layouts, collections, SEO, RSS and a wasm host. Copied, never imported.
Static by default
Core astwerk ships no client runtime. A page with no script is HTML and CSS — the same output a hand-written site would have. If a site needs JavaScript, that is a normal <script> tag or a compiled wasm module; both are ordinary files in the tree.
The optional client-side packages — compiled markup, signals, direct DOM access, a browser DOM for tests — live in the separate astwerk-live extension. That side is still in heavy redesign and is very likely to change or be removed; the client-side tools page in the docs is the honest entry point.
Not for you if…
- You want a config file. Go struct literals are the configuration.
- You want conventions to discover your content. You write the tree.
- You want a client-side framework in the box. Core has no client runtime.
- You want a themes ecosystem. There is a folder of files you copy and edit.
Make it yours
The accent switcher is plain JavaScript and CSS variables. Pick a colour and it sticks for the rest of the site.
indigo — your accent