static-export-site

command
v4.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 9 Imported by: 0

README

102 Static Export Site

This example is the current first-party static export and asset-delivery reference.

It prerenders several routes to files with prerender.Export(...):

  • /
  • /pricing
  • /docs/getting-started

Run it from the repo root:

go run ./examples/server/static-export-site

That writes a dist/ tree under examples/server/static-export-site/dist.

Then serve the generated files from any static host or local file server, for example:

python -m http.server 8088 --directory examples/server/static-export-site/dist

The key point is that the generated site does not need a custom Go request-time server. The example uses the same ui.RenderToString(...) primitives as SSR, but the final deployment shape is static files only.

It now also demonstrates:

  • manifest-backed hashed asset URLs copied into dist/static/
  • route-scoped preload and prefetch hints emitted through head.Render(...)
  • responsive hero image markup with srcset and sizes
  • lazy-loaded secondary media in the exported route HTML

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL