Deploy docs site with Hugo via GitHub Actions#303
Conversation
There was a problem hiding this comment.
Code Review
This pull request transitions the documentation generation from a manual shell script process to a Hugo-based static site generator. It introduces Hugo configuration, layouts, and mise for tool management. Feedback suggests improving internationalization (i18n) by using site-configured language codes and translation functions instead of hardcoded strings in the HTML templates.
| @@ -0,0 +1,207 @@ | |||
| <!doctype html> | |||
| <html lang="en"> | |||
There was a problem hiding this comment.
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>Overview</a> | ||
| <a href="{{ "doc/latest/" | relURL }}">API documentation</a> |
There was a problem hiding this comment.
The navigation labels are hardcoded. Following internationalization (i18n) best practices, these strings should be externalized using Hugo's translation features to allow for easier localization in the future.
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>Overview</a> | |
| <a href="{{ "doc/latest/" | relURL }}">API documentation</a> | |
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>{{ T "overview" | default "Overview" }}</a> | |
| <a href="{{ "doc/latest/" | relURL }}">{{ T "api_documentation" | default "API documentation" }}</a> |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request transitions the project's documentation from a manual script-based generation to a Hugo static site. Key changes include the addition of a Hugo configuration, custom layouts, and a mise setup for managing the Hugo environment. The release script was updated to remove the legacy index generation logic. Review feedback suggests adding a security configuration to hugo.toml to allow mounting the README.md from the parent directory and notes that the API documentation link may result in a 404 during local development.
| [[module.mounts]] | ||
| source = "../README.md" | ||
| target = "content/_index.md" |
There was a problem hiding this comment.
Hugo's security model (introduced in version 0.114.0) restricts mounting files from outside the project root by default. Since the build command uses --source docs, the project root is considered the docs/ directory. Mounting ../README.md may fail in strict environments or CI with a security error.
To ensure the build is portable and reliable, consider adding the following security configuration to your hugo.toml:
| [[module.mounts]] | |
| source = "../README.md" | |
| target = "content/_index.md" | |
| [security] | |
| [security.module] | |
| mounts = ['^project', '^..'] | |
| [[module.mounts]] | |
| source = "../README.md" | |
| target = "content/_index.md" |
| <body> | ||
| <nav class="page-nav"> | ||
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active" aria-current="page"{{ end }}>Overview</a> | ||
| <a href="{{ "/doc/latest/" | relURL }}">API documentation</a> |
There was a problem hiding this comment.
The link to /doc/latest/ uses relURL, which correctly resolves to the subpath on GitHub Pages. However, because the doc/ directory is managed separately on the gh-pages branch and is not part of the Hugo source or static/ directory, this link will result in a 404 error when previewing the site locally using mise run serve-docs.
While this is expected for the production deployment, you might consider adding a note in the documentation or using a local symlink in docs/static/ (ignored by git) to improve the local development experience.
Build with `mise run build-docs`, preview with `mise run serve-docs`. The site mounts the existing `README.md` as the home page so the source of truth stays in one place. A small pill nav links from Overview to the versioned API documentation that lives on the `gh-pages` branch under `doc/latest/`. CSS is inlined in the layout template — no external dependencies. Same Charter serif + forest-green design as the MaxMind-DB spec site. For STF-448. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deploys the Hugo docs site on push to main. The workflow builds the site with `mise run build-docs` and pushes the rendered output onto the existing `gh-pages` branch with `keep_files: true` — that preserves every `/doc/vX.Y.Z/` phpDocumentor subtree exactly as the release script publishes them. Pages keeps deploying from `gh-pages`, so no Terraform change is needed for this repo. All actions are SHA-pinned. For STF-448. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hugo on `main` now owns the Pages index, so the release script no longer needs to write a Jekyll front-matter wrapper around README.md on the gh-pages branch. The phpDocumentor block that builds and publishes `doc/$tag/` is unchanged — that versioned tree continues to live on gh-pages and is preserved by the new workflow's `keep_files: true`. For STF-448. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Migrates the Pages index from Jekyll on
gh-pagesto a Hugo build thatpublishes back onto
gh-pagesfrom GitHub Actions. All CSS is nowinlined in the layout template — no external CDN dependencies.
docs/onmainand mountsREADME.mdas thehome page
at
/doc/latest/.github/workflows/pages.ymlbuilds withmise run build-docsandpushes to
gh-pagesviapeaceiris/actions-gh-pageswithkeep_files: true, so every/doc/vX.Y.Z/subtree stays untoucheddev-bin/release.shno longer regenerates the Jekyllindex.md;the phpDocumentor-publishing block is unchanged
Same design as MaxMind-DB PR #221.
For STF-448.
Post-merge steps
a sample
/doc/latest/still loads after the next workflow rungh-pages, drop the legacy Jekyll sourcefiles
Pages source stays on
gh-pages— no Terraform change for this repo.Test plan
mise run build-docssucceeds with no warnings<title>,<h1>, and pill nav are correctstatic-gh.maxmind.comreferences in the new sitemain)and
/doc/vX.Y.Z/subtrees are preserved🤖 Generated with Claude Code