Deploy docs site with Hugo via GitHub Actions#257
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the project's documentation system to Hugo, replacing a manual script that generated the index page from the README. It introduces a new Hugo configuration, layouts, and mise tasks for building and serving the documentation site. Feedback includes improving accessibility by adding aria-current="page" to active navigation links and ensuring the local development server uses a consistent base URL to prevent broken links.
| </head> | ||
| <body> | ||
| <nav class="page-nav"> | ||
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>Overview</a> |
There was a problem hiding this comment.
For better accessibility, add aria-current="page" to the active navigation link. This helps screen reader users identify the current page within the navigation menu.
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>Overview</a> | |
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active" aria-current="page"{{ end }}>Overview</a> |
|
|
||
| [tasks.serve-docs] | ||
| description = "Serve the docs site locally with Hugo dev server" | ||
| run = "hugo server --source docs" |
There was a problem hiding this comment.
The "API documentation" link in the template uses relURL, which prepends the path from the production baseURL (e.g., /minfraud-api-php/). When running the dev server locally, this link will be broken unless the server is configured with the same base path. Adding the --baseURL flag ensures the local development environment matches the production path structure.
| run = "hugo server --source docs" | |
| run = "hugo server --source docs --baseURL http://localhost/minfraud-api-php/" |
|
/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-based static site generator. It introduces Hugo configuration, layouts, and mise tasks for building and serving the documentation. A review comment correctly identifies that the new navigation links to a /doc/latest/ path which is not currently maintained by the release script, suggesting the addition of a symlink update during the release process.
|
|
||
| cat ../README.md >>$page | ||
|
|
||
| git add doc/ |
There was a problem hiding this comment.
The new Hugo template in docs/layouts/_default/default.html links to /doc/latest/ for the API documentation. However, the release script currently only creates a version-specific directory (doc/$tag) and does not update a latest symlink. To ensure the "API documentation" link in the navigation always points to the most recent version, you should update the latest symlink as part of the release process.
Additionally, since this script no longer manages the root index.md, consider if git commit -a (on line 185) is still appropriate, as it might accidentally stage and commit local artifacts or stale files in the .gh-pages directory that should now be managed by the CI workflow.
| git add doc/ | |
| ln -sf "$tag" doc/latest | |
| git add doc/ |
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
and 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