build: bump Hugo to 0.162.1 and fix deferred CSS template (#25264)

## Summary

The site fails to build on Hugo 0.162, which no longer allows
`templates.Defer` inside a `partialCached` partial. `head.html` called
`utils/css.html` (which defers with a global key) via `partialCached`.
This switches that call to `partial` — the global Defer key already
dedupes the work, so caching was redundant — and bumps the pinned Hugo
version in the `Dockerfile` and `netlify.toml` to 0.162.1.

Verified with a full local build on Hugo 0.162.1 extended (Node 24):
clean build, 3332 pages, no template errors.

## Learnings

- Hugo 0.162 enforces that `templates.Defer` cannot live inside a
`partialCached` partial; the build error points at the deferred
template, not the `partialCached` caller, so trace upward to the caching
call site.

Generated by Claude Code

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Karlsson
2026-06-04 13:04:49 +02:00
committed by GitHub
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ ARG ALPINE_VERSION=3.23
ARG GO_VERSION=1.26
ARG HTMLTEST_VERSION=0.17.0
ARG VALE_VERSION=3.11.2
ARG HUGO_VERSION=0.161.1
ARG HUGO_VERSION=0.162.1
ARG NODE_VERSION=24
ARG PAGEFIND_VERSION=1.5.2
+1 -1
View File
@@ -16,7 +16,7 @@
/>
{{- end -}}
{{ end -}}
{{ partialCached "utils/css.html" "-" "-" }}
{{ partial "utils/css.html" . }}
<link href="/pagefind/pagefind-component-ui.css" rel="stylesheet" />
{{- if hugo.IsProduction -}}
<script
+1 -1
View File
@@ -4,7 +4,7 @@ publish = "public"
[context.deploy-preview.environment]
NODE_VERSION = "24"
NODE_ENV = "production"
HUGO_VERSION = "0.161.1"
HUGO_VERSION = "0.162.1"
HUGO_ENABLEGITINFO = "true"
HUGO_ENVIRONMENT = "preview"
SECRETS_SCAN_OMIT_PATHS = "public/contribute/file-conventions/index.html"