Skip to content

Fix Hugo v0.160+ template compatibility issues#3190

Open
madeline-underwood wants to merge 1 commit intoArmDeveloperEcosystem:mainfrom
madeline-underwood:llm2
Open

Fix Hugo v0.160+ template compatibility issues#3190
madeline-underwood wants to merge 1 commit intoArmDeveloperEcosystem:mainfrom
madeline-underwood:llm2

Conversation

@madeline-underwood
Copy link
Copy Markdown
Collaborator

Summary

Fixes template issues introduced after upgrading Hugo from v0.152.2 to v0.160.1.

Problem

Builds failed on the homepage with:

render: failed to render pages: render of “/” failed: execute of template failed: File is nil

The upgrade also exposed compatibility issues in stats templates related to data access.

Changes
• Added a guard around .File in layouts/index.html to avoid nil access on pages where .File is not set
• Updated layouts/stats/list.html to use hugo.Data.stats_weekly_data instead of .Site.Data.stats_weekly_data

Impact
• Fixes homepage render failure
• Restores successful builds on Hugo v0.160.1
• Updates stats templates for newer Hugo data access

@madeline-underwood
Copy link
Copy Markdown
Collaborator Author

Hi Zach, I had issues running hugo server tonight and AI diagnosed it and suggest we make this code change. I've raised it here as PR for you to review in case it's useful and something we want to merge.

@pareenaverma
Copy link
Copy Markdown
Contributor

Hi @madeline-underwood the fix is not backward compatible with older Hugo versions. The GH actions for deployments uses Hugo 0.130 which breaks with this change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants