Skip to content

Deploy docs site with Hugo and GitHub Actions#434

Open
oschwald wants to merge 3 commits into
mainfrom
greg/stf-448
Open

Deploy docs site with Hugo and GitHub Actions#434
oschwald wants to merge 3 commits into
mainfrom
greg/stf-448

Conversation

@oschwald
Copy link
Copy Markdown
Member

Summary

Migrates the docs site from Jekyll on gh-pages to a Hugo build deployed
via GitHub Actions. All CSS is now inlined in the layout template — no
external CDN dependencies.

  • Hugo site lives under docs/ on main and mounts the existing
    doc/libmaxminddb.md and doc/mmdblookup.md as content, keeping the
    source of truth in one place
  • A small pill nav at the top of each page lets readers move between the
    two docs
  • .github/workflows/pages.yml builds with mise run build-docs and
    deploys via the GitHub Actions Pages environment
  • dev-bin/release.sh no longer clones gh-pages or regenerates the
    index/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

  1. Apply Terraform in mm_website to switch Pages source from
    gh-pages to GitHub Actions
  2. Verify the site at https://maxmind.github.io/libmaxminddb/ and
    https://maxmind.github.io/libmaxminddb/mmdblookup/
  3. Delete the legacy gh-pages branch

Test plan

  • mise run build-docs succeeds with no warnings
  • Both index.html and mmdblookup/index.html render with correct
    titles and working pill-nav
  • grep -r static-gh docs/ returns nothing
  • Build job passes in CI (deploy only runs on main)
  • After merge + Terraform apply, verify the live site renders correctly

🤖 Generated with Claude Code

oschwald and others added 3 commits May 15, 2026 22:33
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>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/hugo.toml
Comment on lines +5 to +6
[[cascade]]
layout = "default"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
[[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>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title>
<title>{{ if .IsHome }}{{ or .Title .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title>

Comment on lines +201 to +204
<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 }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
<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 }}

Comment thread mise.toml
]

[tools]
hugo = "latest"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
hugo = "latest"
hugo = "0.161.1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant