Deploying

Putting the site online, on any static host or one that builds from git.

Docs

Any static host#

public/ is the whole site: plain HTML, CSS, fonts, pictures and a few small scripts. Build it with go run . and upload public/ to any host that serves files, with whatever it offers: an upload page, rsync, scp. Ask the host to answer missing pages with 404.html, if it doesn't already.

A host that builds from git#

A host such as Cloudflare Pages can build the site itself on every push to your repository:

setting value
build command go run .
output directory public
environment variable GO_VERSION = 1.25

For a site in a repository of its own, the build command is go run github.com/spinneydev/coppice@latest, and the output directory still public. @latest builds with the newest coppice; a version, such as @v0.0.0-20261019171619-89aafab60e5e, keeps every build on the same one until you change it.

Cloudflare Pages answers missing pages with public/404.html by itself. A file named _redirects in static/ is copied into the site, for any redirects you need.

Such a host starts each build afresh, without your .cache/, so every build downloads the fonts and makes every gallery thumbnail again: a few seconds for a gallery of a hundred pictures.

A post dated after the day it's pushed appears at the first build on or after its date. To publish such posts on their day without pushing, have the host build once a day: Cloudflare Pages gives each project a deploy hook, a URL that starts a build, which a scheduled job (a cron job, or a scheduled GitHub Action) can call every morning.

Before you publish#

Important

Set url in config.toml to the site's real address. The feed, the sitemap and each page's canonical address are built from it.

  • Run go run . once more and read its output: a build that stops names what's wrong, and pictures without alt text are listed.
  • The build writes /sitemap.xml, every page for search engines, and /robots.txt pointing to it; a robots.txt of your own in static/ takes its place.
  • The CSS and scripts are linked with a short hash of their contents, so readers' browsers fetch them again whenever they change, however long the host tells them to keep them.