The first build

The first version read content/index.md, rendered it with templates/default.html, and wrote output/index.html. All three paths were hardcoded. That was the whole generator.

It was enough to check that the Markdown parser and Go templates worked together. The next job was making it useful for more than that one page.

Giving it somewhere to start

snoopy init my-site
snoopy build -root my-site

The starter command copies a working site out of the binary. From there, the build walks through content/ and gives each Markdown file its own HTML page. A link to ../index.md becomes a link to ../index.html, so the source files can use ordinary relative links.

Not losing the last good build

A build can fail halfway through: a template might be broken, or a page and an asset might want the same output path. Snoopy renders into a temporary directory first and replaces the old output once everything is ready.

It also checks that the output folder belongs to Snoopy before replacing it. Pointing a flag at the wrong folder shouldn’t cost me the files inside it.

What still needs doing

The local server builds once when it starts. For now, editing a page means running another build and refreshing the browser. File watching is still on the list.

Home · Why Snoopy?