Fix Hugo v0.160+ template compatibility issues#3190
Open
madeline-underwood wants to merge 1 commit intoArmDeveloperEcosystem:mainfrom
Open
Fix Hugo v0.160+ template compatibility issues#3190madeline-underwood wants to merge 1 commit intoArmDeveloperEcosystem:mainfrom
madeline-underwood wants to merge 1 commit intoArmDeveloperEcosystem:mainfrom
Conversation
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. |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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