Managing Documentation Versions
Golem documentation is stored under docs/src/content/<version>/. Write new material in next; released directories are frozen snapshots.
Current wiring
docs/src/lib/versions.ts: VERSIONS, lifecycle status, and DEFAULT_VERSION.
docs/src/app/[version]/page.tsx: version index (/<version>).
docs/src/app/[version]/[...mdxPath]/page.tsx: non-index pages (/<version>/...). These are deliberately split; there is no optional-catch-all route.
docs/src/app/[version]/layout.tsx: version-aware Nextra layout, selector, banner, and Pagefind filter.
docs/src/app/page.tsx: root redirect.
docs/src/proxy.ts: redirects eligible unversioned routes to the default version.
docs/src/lib/version-manifest.ts and docs/src/components/version-selector.tsx: same-page/nearest-parent switching between versions.
docs/scripts/version-tool.ts: prefix, clone, rename, and check.
docs/next.config.mjs: Next configuration and the place to add explicit redirects.
Link rules and checker scope
In prose MDX, use version-prefixed documentation links such as /next/quickstart or /v1.5/quickstart. Keep public assets such as /images/foo.png unprefixed.
Run from docs/:
bun run scripts/version-tool.ts check [<registered-version>]
Do not overstate this check. It checks registered version prefixes from VERSIONS and only the supported prose forms:
- Markdown destinations:
](/path) and ](/path "title")
- quoted JSX/HTML
href and to attributes
It skips fenced code, public top-level paths, already registered version prefixes, relative links, and unsupported forms such as href={...}. It does not prove that a destination exists, that a cross-version link is desirable, or that an unregistered new slug is valid. check <slug> selects a content directory but does not register that slug; update versions.ts before relying on it.
Cut a release (next to vX.Y)
Run version-tool commands from docs/.
Move next and rewrite links inside the moved tree:
bun run scripts/version-tool.ts rename next vX.Y
Clone the release back to next, rewriting links in the clone:
bun run scripts/version-tool.ts clone vX.Y next
Update docs/src/lib/versions.ts: add vX.Y as current, demote the previous current version to legacy, set DEFAULT_VERSION, and retain next as unreleased.
Regenerate the live sources of truth into next from the repository root:
cargo make generate-docs-openapi
cargo make generate-docs-skills
The How-To generator replaces and generates all of these outputs:
docs/src/content/next/how-to-guides.mdx
- skill pages under
docs/src/content/next/how-to-guides/<category>/
- category landing pages
docs/src/content/next/how-to-guides/<category>.mdx
- top-level and per-category
_meta.js files
Inspect the diff, especially the frozen release versus regenerated next, then verify:
# from docs/
bun run scripts/version-tool.ts check
bun run build:check
bun run build
# from the repository root
cargo make check-docs-openapi
cargo make check-docs-skills
Smoke-test /, both version index routes, nested pages, version switching, and the next/legacy banners.
Verify Pagefind without hardcoded filenames or slugs
bun run build runs Pagefind as postbuild and writes docs/public/_pagefind. Do not depend on compressed internal filenames, strings, a fixed filter count, or a hardcoded version list. Derive expected slugs from VERSIONS, then query the generated index through Pagefind's JavaScript API (or run the site and use the search UI) and verify that each registered version can be supplied as the version filter and returns results for known text in that version. Also confirm the build log contains no Pagefind errors and that public/_pagefind/pagefind.js and pagefind-entry.json exist.
Backport to a released version
Edit the frozen MDX directly, preserve that version's link prefix, and run:
cd docs
bun run scripts/version-tool.ts check vX.Y
bun run build:check
Generators accept --version vX.Y, but use that only when today's source inputs genuinely represent that release:
bun run openapi/gen-openapi.ts --version vX.Y
bun run skills/sync-skills.ts --local .. --version vX.Y
Rename, add, or retire a version
- Rename content with
bun run scripts/version-tool.ts rename <old> <new>, then update versions.ts. The tool rewrites links only in the moved tree.
- Add a page under
src/content/<version>/, register it in the nearest _meta.js, and use that version's prefix.
- To retire content, remove its directory and registry entry. If old URLs should redirect, add an explicit redirect in
docs/next.config.mjs; removing content or changing the registry does not create one. Check redirect ordering alongside src/proxy.ts and test both index and nested old URLs.
Editing cautions
- Do not hand-edit generated
next/rest-api/ or any generated How-To output. Change its source and regenerate.
prefix is an initial-migration helper, not routine formatting. clone and rename reject an existing destination.
- Public assets remain unprefixed. Prefer same-version documentation links; the selector handles navigation across snapshots.
- If development state appears stale, clearing
.next may help, but do not claim that production builds are categorically unaffected by development-router or bundler problems. Verify the production build.
1---2name: managing-docs-versions3description: Cutting a new docs version, promoting next to a release, and managing versioned documentation content under docs/src/content/. Use when releasing a Golem version, backporting docs fixes, renaming a docs version, or changing the version selector.4---56# Managing Documentation Versions78Golem documentation is stored under `docs/src/content/<version>/`. Write new material in `next`; released directories are frozen snapshots.910## Current wiring1112- `docs/src/lib/versions.ts`: `VERSIONS`, lifecycle status, and `DEFAULT_VERSION`.13- `docs/src/app/[version]/page.tsx`: version index (`/<version>`).14- `docs/src/app/[version]/[...mdxPath]/page.tsx`: non-index pages (`/<version>/...`). These are deliberately split; there is no optional-catch-all route.15- `docs/src/app/[version]/layout.tsx`: version-aware Nextra layout, selector, banner, and Pagefind filter.16- `docs/src/app/page.tsx`: root redirect.17- `docs/src/proxy.ts`: redirects eligible unversioned routes to the default version.18- `docs/src/lib/version-manifest.ts` and `docs/src/components/version-selector.tsx`: same-page/nearest-parent switching between versions.19- `docs/scripts/version-tool.ts`: `prefix`, `clone`, `rename`, and `check`.20- `docs/next.config.mjs`: Next configuration and the place to add explicit redirects.2122## Link rules and checker scope2324In prose MDX, use version-prefixed documentation links such as `/next/quickstart` or `/v1.5/quickstart`. Keep public assets such as `/images/foo.png` unprefixed.2526Run from `docs/`:2728```shell29bun run scripts/version-tool.ts check [<registered-version>]30```3132Do not overstate this check. It checks registered version prefixes from `VERSIONS` and only the supported prose forms:3334- Markdown destinations: `](/path)` and `](/path "title")`35- quoted JSX/HTML `href` and `to` attributes3637It skips fenced code, public top-level paths, already registered version prefixes, relative links, and unsupported forms such as `href={...}`. It does not prove that a destination exists, that a cross-version link is desirable, or that an unregistered new slug is valid. `check <slug>` selects a content directory but does not register that slug; update `versions.ts` before relying on it.3839## Cut a release (`next` to `vX.Y`)4041Run version-tool commands from `docs/`.42431. Move `next` and rewrite links inside the moved tree:4445 ```shell46 bun run scripts/version-tool.ts rename next vX.Y47 ```48492. Clone the release back to `next`, rewriting links in the clone:5051 ```shell52 bun run scripts/version-tool.ts clone vX.Y next53 ```54553. Update `docs/src/lib/versions.ts`: add `vX.Y` as `current`, demote the previous current version to `legacy`, set `DEFAULT_VERSION`, and retain `next` as `unreleased`.56574. Regenerate the live sources of truth into `next` from the repository root:5859 ```shell60 cargo make generate-docs-openapi61 cargo make generate-docs-skills62 ```6364 The How-To generator replaces and generates **all** of these outputs:65 - `docs/src/content/next/how-to-guides.mdx`66 - skill pages under `docs/src/content/next/how-to-guides/<category>/`67 - category landing pages `docs/src/content/next/how-to-guides/<category>.mdx`68 - top-level and per-category `_meta.js` files69705. Inspect the diff, especially the frozen release versus regenerated `next`, then verify:7172 ```shell73 # from docs/74 bun run scripts/version-tool.ts check75 bun run build:check76 bun run build7778 # from the repository root79 cargo make check-docs-openapi80 cargo make check-docs-skills81 ```82836. Smoke-test `/`, both version index routes, nested pages, version switching, and the `next`/legacy banners.8485### Verify Pagefind without hardcoded filenames or slugs8687`bun run build` runs Pagefind as `postbuild` and writes `docs/public/_pagefind`. Do not depend on compressed internal filenames, `strings`, a fixed filter count, or a hardcoded version list. Derive expected slugs from `VERSIONS`, then query the generated index through Pagefind's JavaScript API (or run the site and use the search UI) and verify that each registered version can be supplied as the `version` filter and returns results for known text in that version. Also confirm the build log contains no Pagefind errors and that `public/_pagefind/pagefind.js` and `pagefind-entry.json` exist.8889## Backport to a released version9091Edit the frozen MDX directly, preserve that version's link prefix, and run:9293```shell94cd docs95bun run scripts/version-tool.ts check vX.Y96bun run build:check97```9899Generators accept `--version vX.Y`, but use that only when today's source inputs genuinely represent that release:100101```shell102bun run openapi/gen-openapi.ts --version vX.Y103bun run skills/sync-skills.ts --local .. --version vX.Y104```105106## Rename, add, or retire a version107108- Rename content with `bun run scripts/version-tool.ts rename <old> <new>`, then update `versions.ts`. The tool rewrites links only in the moved tree.109- Add a page under `src/content/<version>/`, register it in the nearest `_meta.js`, and use that version's prefix.110- To retire content, remove its directory and registry entry. **If old URLs should redirect, add an explicit redirect in `docs/next.config.mjs`; removing content or changing the registry does not create one.** Check redirect ordering alongside `src/proxy.ts` and test both index and nested old URLs.111112## Editing cautions113114- Do not hand-edit generated `next/rest-api/` or any generated How-To output. Change its source and regenerate.115- `prefix` is an initial-migration helper, not routine formatting. `clone` and `rename` reject an existing destination.116- Public assets remain unprefixed. Prefer same-version documentation links; the selector handles navigation across snapshots.117- If development state appears stale, clearing `.next` may help, but do not claim that production builds are categorically unaffected by development-router or bundler problems. Verify the production build.