Hugo deprecation warning: config key languageCode should become locale #18
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Building the site with a current Hugo emits:
hugo.tomlsetslanguageCode. Hugo deprecated that key in v0.158.0 infavour of
locale, and says it will be removed in a future release. When itis removed the key becomes silently inert (or the build fails, depending on
how Hugo lands the removal), so this is a latent breakage, not just noise.
Found while working on #7 (PR #17); not fixed there because it is outside
that issue's scope.
Why it is not visible in CI today
The
Dockerfileinstalls hugo from alpine 3.21's apk repo, which is hugo0.139.0 — older than 0.158.0, so it does not emit the warning. The warning
appears on any newer hugo (seen on 0.164.0). So CI is currently green on a
Hugo old enough not to know about the deprecation, while a developer with a
current Hugo sees the warning locally. That divergence is worth noting on its
own, but is not this issue.
Definition of done
hugo.tomluseslocaleinstead oflanguageCode.this key.
langattribute in the emitted HTML andany language-derived formatting stay the same).
make checkpasses andscript/cibuildsucceeds.Out of scope
Dockerfile/CI. That is a separatedecision with its own risk and should be its own issue if wanted.
hugo.tomlrestructuring.Sequencing update — this issue is now coupled to #26 (install Hugo at a
deliberate, hash-verified version rather than taking alpine's).
The reason this warning is invisible in CI is stated in the body above: alpine
3.21 serves Hugo 0.139.0, which predates the 0.158.0 deprecation. #26 moves the
build onto a current Hugo, which will surface this warning in CI for the
first time.
So the options are: fix this issue first, or fix it inside #26's branch. What
must not happen is #26 merging and leaving CI newly noisy — that would add a
third routinely-ignored warning alongside #13's taxonomy warning, which is
precisely the "everyone learns to ignore build output" failure mode #13 already
warns about.
Note also that this issue's definition of done says "the site builds clean on a
current Hugo with no deprecation warning from this key". Until #26 lands, that
cannot be verified in CI at all — only locally against a developer's own Hugo.
Whoever picks this up before #26 should say plainly that the verification was
local-only, rather than implying CI confirmed it. Verifying against an
environment that structurally cannot show the problem is the mistake that cost
this repo an outage in #7.
Both this and #13 are prerequisites for #25 (
--panicOnWarning), which cannotland while any warning is outstanding.
Correction to my previous comment: this must NOT land before #26. Tested
rather than assumed, and the result inverts the advice.
Under CI's Hugo 0.139.0, swapping
languageCode = 'en-us'forlocale = 'en-us'silently changes the generated RSS from<language>en-us</language>to<language>en</language>. Old Hugo does notknow the
localekey, ignores it, and falls back to a default. No warning, noerror, exit 0 — an output regression that the gate would not catch.
So: fix this inside #26's branch, after the Hugo version moves. Landing it
first would break output on the Hugo CI actually runs.
Added to the definition of done: the RSS
<language>element must still readen-usafter the change, verified on the Hugo version the build actually uses.Implementation plan
Per the correction above, this is being done inside #26's branch, in a
commit on top of the Hugo version move — not before it.
hugo v0.164.0 installed by
go install.hugo.toml'slanguageCode = 'en-us'tolocale = 'en-us', on top of 1, so the key is never interpreted by a Hugothat does not know it.
Verification, on the Hugo the build actually uses
<language>element asserted to still readen-us— this is theregression the second comment above found under 0.139.0, and the whole
reason for the ordering.
langattribute in the emitted HTML unchanged.public/diffed between commit 1 and commit 2: the config change must be ano-op on rendered output.
act_runnerrun ofdeploy.yml'sbuildjob, not local-only.