Skip to content

feat: require Hugo v0.158.0 and clear its deprecations - #2322

Merged
markdumay merged 2 commits into
mainfrom
feat/hugo-floor-0.158
Nov 4, 2026
Merged

markdumay merged 2 commits into
mainfrom
feat/hugo-floor-0.158

Conversation

@markdumay

@markdumay markdumay commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Raises Hinode's minimum Hugo version to v0.158.0 and clears every deprecation listed in #2049. Closes #2314 and #2315.

Commits

  1. feat: require Hugo v0.158.0 or later (Require Hugo v0.158.0 and rename the language config keys #2314)
    • Raises module.hugoVersion.min in config/_default/hugo.toml and min_version in theme.toml.
    • Renames languageCode → locale and languageName → label in the module config, exampleSite and tests/templates.
    • Before v0.158.0, Hugo silently ignores locale and label, so the floor moves with the rename.
  2. fix: move templates off the APIs Hugo deprecated before v0.158.0 (Migrate templates off the APIs deprecated before Hugo v0.158.0 #2315)
    • Bumps mod-utils to v6.18.1 and mod-csp to v1.0.17, and mod-blocks to v2.15.2 in exampleSite.
    • site.Languages → new utilities/GetLanguages.html, built on hugo.Sites. Used by head.html, navbar-languages, download and sharing.
    • .LanguageName → .Label and .LanguageCode → .Locale.
    • site.Data → mod-utils GetData in GetDimension, abbr.html, abbr.md and args.md.
    • .Site.AllPages in index.redir → hugo.Sites.
    • Adds two tests: test:renderer and test:languages. CI runs both.

The floor commit comes first, so every commit on main builds on the Hugo version it declares.

Live editing

CloudCannon's Live Editor renders partials with Bookshop's embedded Hugo v0.147.6, where hugo.Sites, hugo.Data, .Label and .Locale fail. Every change in a partial or shortcode therefore sits behind a hugo.Version.Compare check that keeps the old call. index.redir is never loaded there, so it switches outright.

hugo.Sites holds one site per language × version × role. GetLanguages and index.redir keep the sites that share the first site's version and role, as mod-utils' GetPage does. That reproduces site.Languages and site.AllPages exactly.

Verification

  • exampleSite output is byte-identical to main on Hugo 0.169.0 (645 files) and on 0.158.0.
  • At --logLevel info it logs no deprecation from Hugo deprecation warnings on v0.164 can't be resolved without raising the v0.146.0 floor #2049's table. Only resources.PostProcess (Replace resources.PostProcess with templates.Defer #2319) and Hugo 0.169's INFO .Params.title notice remain.
  • test:languages builds a multilingual fixture without versions or roles, with versions, with roles, and with English only.
    • The partials, shortcodes, head.html and _redirects must equal the deprecated APIs' results.
    • A final build fails on any deprecation.
    • It passes on Hugo 0.156.0, 0.157.0, 0.158.0 and 0.169.0.
  • test:renderer runs the changed partials in Bookshop's real v0.147.6 renderer. Negative controls (unguarded hugo.Sites, .Label and .Locale) must fail.
  • pnpm test passes at each commit. pnpm audit --prod --audit-level=high is clean.
  • Blind review: two rounds. The first found an untrue statement about the quiet check and three gaps where a broken change passed the tests; all are fixed.
  • Union review: with the released mod-utils, mod-csp, mod-hanko and mod-blocks, the template, theme-agency, gethinode.com and squadra.nl builds against this branch give the same output as before. squadra.nl's live-editing components render 15 of 15 in the real renderer.

For consumers

Sites that bump to this release should rename languageCode → locale and languageName → label. The old keys still work and only warn.

Rename both levels together. On Hugo 0.158 or later, a top-level locale combined with a per-language languageCode gives the default content language the top-level value instead of its own (measured on 0.158.0 and 0.166.0: en resolves to en-us instead of en-gb). Other languages are unaffected, and any consistent spelling at both levels is fine.

🤖 Generated with Claude Code

markdumay and others added 2 commits November 3, 2026 23:51
Raise module.hugoVersion.min in config/_default/hugo.toml and
min_version in theme.toml from v0.153.1 to v0.158.0. Hugo v0.158.0
renamed the languageCode config key to locale and languageName to
label, and an older Hugo ignores the new keys, so the floor moves with
the rename. The module config, exampleSite and tests/templates now use
locale and label.

Config never reaches Bookshop's live-editing renderer, so the rename
needs no guard.

Refs #2314, #2049

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bump mod-utils to v6.18.1 and mod-csp to v1.0.17, which read data and
images through guarded APIs, and mod-blocks to v2.15.2 in exampleSite,
which reads its structures through GetData. Then migrate hinode's own
templates:

- site.Languages: the new utilities/GetLanguages.html collects the
  languages from hugo.Sites, kept to the version and role of the first
  site so that each language appears once, in site.Languages' order.
  head.html, navbar-languages, download and sharing use it.
- .LanguageName and .LanguageCode: read .Label and .Locale instead.
- site.Data: GetDimension and the abbr shortcode read mod-utils' GetData,
  as do the Markdown variants of the abbr and args shortcodes.
- .Site.AllPages: index.redir collects the same pages from hugo.Sites
  and sorts them by weight, as site.AllPages did.

Each partial and shortcode change sits behind a hugo.Version.Compare
guard, because Bookshop's live-editing renderer runs Hugo v0.147.6,
where the new APIs fail. index.redir has no guard: the renderer never
loads it.

Add two tests. test:renderer renders the changed partials and the abbr
shortcode in Bookshop's renderer (harness copied from mod-utils), with
negative controls for unguarded hugo.Sites, .Label and .Locale. Its
config keeps languageName, because Hugo v0.147.6 predates label.

test:languages builds a multilingual fixture without versions or roles,
with versions, with roles, and with English only. It compares the
partials, the abbr shortcode and _redirects with the deprecated APIs,
and checks that head.html declares the language only when the site has
more than one. Its abbr and args pages also render Markdown output,
which runs the shortcodes' .md variants. A last build of the fixture
leaves the comparisons out and fails on any deprecation it logs.

CI runs both tests after test:templates.

Refs #2315

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for gethinode-demo ready!

Name Link
🔨 Latest commit bf89428
🔍 Latest deploy log https://app.netlify.com/projects/gethinode-demo/deploys/6aea6b4034546086abeca2c2
😎 Deploy Preview https://deploy-preview-2322--gethinode-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@markdumay
markdumay merged commit 6c847da into main Nov 4, 2026
17 checks passed
@markdumay

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 3.51.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Require Hugo v0.158.0 and rename the language config keys

1 participant