Deploy docs site with Hugo and GitHub Actions#434
Conversation
Build with `mise run build-docs`, preview with `mise run serve-docs`. The site mounts the existing `doc/libmaxminddb.md` and `doc/mmdblookup.md` as Hugo content so the source of truth stays in one place. A small pill nav lets readers move between the two pages. 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. Uses the same mise-action pattern as PR #221. All actions are SHA-pinned. After merge, the Pages source needs to flip from "Deploy from a branch" (gh-pages) to "GitHub Actions" — handled in the mm_website Terraform PR. The legacy gh-pages branch can then be deleted. For STF-448. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The release script no longer needs to clone the gh-pages branch and regenerate Jekyll index/mmdblookup pages — the new Hugo workflow on main owns the docs site, and the doc/*.md files are now mounted as content directly. There is no versioned doc tree on gh-pages to preserve for this repo. For STF-448. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request migrates the project documentation from Jekyll to Hugo. It removes the manual documentation generation logic from the release script, adds Hugo configuration and layouts, and introduces mise tasks for building and serving the site. Review feedback focuses on refining the Hugo implementation, specifically restoring descriptive page titles lost during the migration, improving title tag logic, utilizing link titles in navigation, and pinning the Hugo version in the configuration for better build reproducibility.
| [[cascade]] | ||
| layout = "default" |
There was a problem hiding this comment.
The migration to Hugo has resulted in the loss of descriptive page titles that were previously provided in the Jekyll front matter. Currently, Hugo defaults to using the filename (e.g., "mmdblookup") as the title. You can restore the descriptive titles (and optionally provide shorter link titles for the navigation) using Hugo's cascade feature in the configuration file.
| [[cascade]] | |
| layout = "default" | |
| [[cascade]] | |
| layout = "default" | |
| [[cascade]] | |
| [cascade._target] | |
| path = "/_index.md" | |
| title = "libmaxminddb - a library for working with MaxMind DB files" | |
| linkTitle = "libmaxminddb" | |
| [[cascade]] | |
| [cascade._target] | |
| path = "/mmdblookup.md" | |
| title = "mmdblookup - a utility to look up an IP address in a MaxMind DB file" | |
| linkTitle = "mmdblookup" |
| <meta charset="utf-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| {{- $title := or .Title .File.BaseFileName -}} | ||
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title> |
There was a problem hiding this comment.
To support descriptive titles for the home page (set via configuration or front matter), the title tag should check for .Title before falling back to .Site.Title.
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title> | |
| <title>{{ if .IsHome }}{{ or .Title .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title> |
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>{{ .Site.Title }}</a> | ||
| {{ range .Site.RegularPages }} | ||
| <a href="{{ .RelPermalink }}"{{ if eq $.RelPermalink .RelPermalink }} class="active"{{ end }}>{{ or .Title .File.BaseFileName }}</a> | ||
| {{ end }} |
There was a problem hiding this comment.
Using .LinkTitle in the navigation allows for shorter labels in the pill nav while maintaining descriptive titles for the browser tab. This works in conjunction with the cascade settings in hugo.toml.
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>{{ .Site.Title }}</a> | |
| {{ range .Site.RegularPages }} | |
| <a href="{{ .RelPermalink }}"{{ if eq $.RelPermalink .RelPermalink }} class="active"{{ end }}>{{ or .Title .File.BaseFileName }}</a> | |
| {{ end }} | |
| <a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>{{ or .Site.Home.LinkTitle .Site.Title }}</a> | |
| {{ range .Site.RegularPages }} | |
| <a href="{{ .RelPermalink }}"{{ if eq $.RelPermalink .RelPermalink }} class="active"{{ end }}>{{ or .LinkTitle .Title .File.BaseFileName }}</a> | |
| {{ end }} |
| ] | ||
|
|
||
| [tools] | ||
| hugo = "latest" |
There was a problem hiding this comment.
It is recommended to pin the Hugo version to a specific version (e.g., the one currently in the lock file) to ensure build reproducibility across different environments and CI. Using latest can lead to unexpected build failures if a new version of Hugo introduces breaking changes.
| hugo = "latest" | |
| hugo = "0.161.1" |
Summary
Migrates the docs site from Jekyll on
gh-pagesto a Hugo build deployedvia GitHub Actions. All CSS is now inlined in the layout template — no
external CDN dependencies.
docs/onmainand mounts the existingdoc/libmaxminddb.mdanddoc/mmdblookup.mdas content, keeping thesource of truth in one place
two docs
.github/workflows/pages.ymlbuilds withmise run build-docsanddeploys via the GitHub Actions Pages environment
dev-bin/release.shno longer clonesgh-pagesor regenerates theindex/mmdblookup Jekyll pages
Same design as MaxMind-DB PR #221: Charter serif body text, forest-green
accent on field-name headings, hover
#anchor links.Preview locally with
mise run serve-docs.For STF-448.
Post-merge steps
mm_websiteto switch Pages source fromgh-pagesto GitHub Actionshttps://maxmind.github.io/libmaxminddb/mmdblookup/
gh-pagesbranchTest plan
mise run build-docssucceeds with no warningsindex.htmlandmmdblookup/index.htmlrender with correcttitles and working pill-nav
grep -r static-gh docs/returns nothingmain)🤖 Generated with Claude Code