Skip to content

fix: keep the RSS <language> element working on Hugo < 0.158#2054

Merged
markdumay merged 2 commits into
mainfrom
compat/hugo-0147-rss-locale
Jul 18, 2026
Merged

fix: keep the RSS <language> element working on Hugo < 0.158#2054
markdumay merged 2 commits into
mainfrom
compat/hugo-0147-rss-locale

Conversation

@markdumay

Copy link
Copy Markdown
Collaborator

What

site.Language.Locale was added in Hugo 0.158 (when languageCode was deprecated in its
favour). layouts/rss.xml uses it unconditionally, so on Hugo 0.146–0.157 every RSS render
fails with:

rss.xml:53:15: executing "rss.xml" at <site>: can't evaluate field Locale in type *langs.Language

Version-gate it: site.Language.Locale on Hugo ≥ 0.158, site.Language.LanguageCode on older
Hugo. hugo.Version.Compare "0.158.0" is a semantic (not string) version test.

-<language>{{ site.Language.Locale }}</language>
+<language>{{ if le (hugo.Version.Compare "0.158.0") 0 }}{{ site.Language.Locale }}{{ else }}{{ site.Language.LanguageCode }}{{ end }}</language>

Why

Restores the theme's stated Hugo compatibility floor. Found while validating Hugo 0.147.6
support for the starter template.

Evidence

  • exampleSite RSS renders with no error on Hugo 0.147.6 and 0.164.0; <language> = en-us
    on 0.164, the language code on 0.147.6.

Held for review. (Separately: the search-index templates.Defer leak on Hugo < 0.164 is
fixed in gethinode/mod-flexsearch#310; the two together restore hinode-v3.6.0 rendering on Hugo
0.147.6+. A postcss-transform failure seen locally on 0.147.6 traces to a broken pnpm .bin/postcss
shim on the dev machine — not a theme defect.)

site.Language.Locale was added in Hugo 0.158 (languageCode was deprecated in its
favour). On Hugo 0.146-0.157 the RSS template errored with "can't evaluate field
Locale in type *langs.Language", failing every RSS render. Version-gate it:
site.Language.Locale on Hugo >= 0.158, site.Language.LanguageCode on older Hugo.

Verified: exampleSite RSS renders with no error on Hugo 0.147.6 and 0.164.0.
@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for gethinode-demo ready!

Name Link
🔨 Latest commit d0876f2
🔍 Latest deploy log https://app.netlify.com/projects/gethinode-demo/deploys/6a5b0c1d2447c20008e6e42a
😎 Deploy Preview https://deploy-preview-2054--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 9110f48 into main Jul 18, 2026
16 checks passed
@markdumay
markdumay deleted the compat/hugo-0147-rss-locale branch July 18, 2026 05:22
@markdumay

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 3.6.2 🎉

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.

1 participant