Export Help as a Static Website

Use `glaze render-site` to export the Glazed help browser as a static site that can be previewed locally or hosted without a Go server.

Sections

Terminology & Glossary
📖 Documentation
Navigation
74 sectionsv0.1
📄 Export Help as a Static Website — glaze help export-help-static-website
export-help-static-website

Export Help as a Static Website

Use `glaze render-site` to export the Glazed help browser as a static site that can be previewed locally or hosted without a Go server.

Topichelphttpwebstaticdocumentationrender-sitehelpoutput-diroverwritebase-pathdata-dir+1

Why glaze render-site exists

glaze render-site exports the same help browser used by glaze serve, but writes everything to disk instead of starting a live HTTP server. The exported site contains the SPA assets, a runtime config file, and a static JSON snapshot of the loaded help sections.

This matters when you want browser-based help without keeping a Go process running. It is useful for publishing documentation to a static host, attaching generated docs to a release artifact, or previewing a frozen documentation snapshot during review.

Use glaze render-site from the command line

The simplest invocation exports the built-in Glazed documentation into ./glaze-site:

glaze render-site

You can also export a custom help tree from one or more markdown files or directories:

glaze render-site ./pkg/doc
glaze render-site ./pkg/doc ./more-docs

If you want to choose the destination directory explicitly, use --output-dir:

glaze render-site ./pkg/doc --output-dir /tmp/glaze-doc-site

When the command runs:

  • If no paths are given, it exports the help pages already loaded into the help system.
  • If paths are given, it clears the preloaded sections and exports only the sections discovered from those explicit paths.
  • It copies the embedded frontend into the output directory.
  • It writes a site-config.js file and a site-data/ JSON tree the SPA can browse without /api/....

Important flags

These flags control where the site is written and how the generated URLs behave:

FlagWhat it doesWhen to use it
--output-dirChooses the export directoryUse it when you do not want the default ./glaze-site path
--overwriteAllows reusing a non-empty output directoryUse it when regenerating an existing export
--base-pathWrites a base path into the runtime configUse it when the site will be hosted under a prefix such as /docs
--data-dirRenames the relative directory that stores exported JSONUse it only if you have a hosting constraint or want a different layout
--site-titleSets the title written into the runtime configUse it when exporting docs for another application or branded site

What the export contains

The exported site is a normal directory tree. The exact asset filenames under assets/ are content-hashed and may change between builds, but the stable files and directories look like this:

PathPurpose
index.htmlSPA entrypoint
site-config.jsRuntime config that tells the frontend to run in static mode
assets/Bundled JS and CSS assets for the embedded frontend
site-data/health.jsonHealth metadata with the number of exported sections
site-data/sections.jsonFull list of section summaries used for the sidebar
site-data/sections/<slug>.jsonPer-section detail payloads
site-data/indexes/topics.jsonTopic-to-slug lookup index
site-data/indexes/commands.jsonCommand-to-slug lookup index
site-data/indexes/flags.jsonFlag-to-slug lookup index
site-data/indexes/top-level.jsonSlugs marked as top-level
site-data/indexes/defaults.jsonSlugs shown by default
site-data/manifest.jsonBuild metadata for the exported snapshot

Preview the exported site locally

The exported output is static, so you can preview it with any simple file server. A quick local check looks like this:

glaze render-site ./pkg/doc --output-dir /tmp/glaze-doc-site --overwrite
python3 -m http.server 8123 --directory /tmp/glaze-doc-site

Then open:

http://127.0.0.1:8123/

Because the frontend uses hash routes, links such as #/sections/help-system work on simple static hosting without server-side route rewrites.

Host the exported site

The generated output can be copied to any static host that serves plain files. In practice that includes:

  • local file servers used during development,
  • Nginx or Caddy serving a directory,
  • static hosting services such as GitHub Pages,
  • artifact previews attached to CI or release pipelines.

If you are hosting under a sub-path such as /docs, export with --base-path /docs so the runtime config points the SPA at the right static JSON directory.

glaze render-site ./pkg/doc --output-dir ./dist/docs --base-path /docs --overwrite

How this differs from glaze serve

glaze serve and glaze render-site use the same help content and the same frontend, but they solve different delivery problems:

CommandBest forRuntime model
glaze serveLocal exploration, embedding into a live Go server, dynamic API accessStarts an HTTP server and serves /api/... plus the SPA
glaze render-sitePublishing or sharing a frozen documentation snapshotWrites files to disk and serves no live API

Choose serve when you want a running server process. Choose render-site when you want an artifact you can copy, host, or review later.

Troubleshooting

ProblemCauseSolution
output directory "...\" is not emptyThe destination already contains files and --overwrite was not setRe-run with --overwrite or choose a fresh output directory
The export completes but expected pages are missingThe supplied markdown files were not loaded or did not contain valid help frontmatterVerify the paths exist, files end in .md, and the frontmatter includes fields like Title, Slug, and SectionType
The browser loads index.html but sections do not appearThe site is being opened incorrectly or the exported JSON tree is missingServe the directory over HTTP and confirm site-config.js and site-data/sections.json exist
Links work at / but not under /docs or another prefixThe static host path and exported base path do not matchRe-export with --base-path set to the hosted prefix
A regenerated site still shows old contentThe old output directory contents were left in placeRe-run with --overwrite to clear the export directory before writing the new snapshot

See Also

  • glaze help export-help-entries — Export help sections to files, JSON, CSV, or SQLite
  • glaze help serve-help-over-http
  • glaze help writing-help-entries
  • glaze help how-to-write-good-documentation-pages
  • glaze help sections-guide