Back to Lab
Experimental #documentation#static-sites#go#open-source

sitecrate: a whole static site in one HTML file

A command-line tool that packs a static site, such as a Sphinx or MkDocs manual, into a single self-contained HTML file that opens from disk or any web server, with navigation, deep links and search still working.

View on GitHub

sitecrate packs a complete static site into one HTML file. Every page, stylesheet, script, image and font goes inside it, and the file opens straight from disk (file://) or from any web server, with no extraction step and no server-side support. Links between pages, back/forward, deep links and site search keep working inside the file.

Why

Documentation generators such as Sphinx, MkDocs or Hugo produce a folder of hundreds of files. That folder works when it is hosted, and is awkward to hand to anyone otherwise. As a single file, the same manual can be:

  • attached to a release next to the binaries, so every version ships with its own manual
  • included in a product, installer or container image, for reading offline or in air-gapped networks
  • sent by email, or uploaded to a ticketing system or customer portal that only takes single files
  • archived alongside a delivery, with links into it (manual.html#/guide/install.html) that keep working

How it works

The CLI walks the site, gzips the files together with a small manifest and embeds them, unmodified, in the HTML file next to a small JavaScript runtime. When the file is opened, the runtime inflates the payload in the browser and renders each page in a full-window iframe, turning assets into blob URLs and links to other pages into routes inside the file.

Multi-page navigation, anchors, <base href>, refresh redirects, GET forms, fetch() of site files and Sphinx’s built-in search all work. Some things don’t, such as XMLHttpRequest, web workers, relative ES module imports and resources loaded from other hosts; the README lists them.

Try it

Prebuilt binaries for Linux, macOS and Windows are attached to each release. To build from source with Go 1.27 or later:

go install github.com/blackshieldpt/sitecrate/cmd/sitecrate@latest

sphinx-build docs docs/_build/html
sitecrate docs/_build/html -o manual.html

sitecrate is open source under the Apache 2.0 license.