Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fix deprecated code - build failed on latest Hugo (v0.112.0) 0 Language.Params deprecaiton warning #1224

Closed
darrenkearney opened this issue May 23, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@darrenkearney
Copy link

darrenkearney commented May 23, 2023

Describe the bug

When attempting to build on latest hugo, there is adeprecation warning for Language.Params for PaperMod layout files. This causes build to fail.
This is due to recent enhancements with Hugo handling language configs.
Related issue on hugo's issue tracker: gohugoio/hugo#10947

  • Device/Os: WSL Ubuntu 22.04 running on WSL on Windows 10. - Likely all devices and operating systems.
  • Type: Desktop
  • Hugo Version >=0.112.0 expected.
  • Theme Version

Steps to reproduce the behavior:

  1. Get the latest version of hugo >=v0.112.0 at https://github.com/gohugoio/hugo/releases/tag/v0.112.0
  2. run hugo --panicOnWarning command in your project root directory to attempt to build the project.
  3. Note the build fail message.

Expected behavior:

  1. Get the latest version of hugo >=v0.112.0 at https://github.com/gohugoio/hugo/releases/tag/v0.112.0
  2. Run hugo --panicOnWarning to attempt to build the project.
  3. Project builds successfully.

Repo/Source where this issue can be reproduced:

https://github.com/adityatelange/hugo-PaperMod/releases/tag/v7.0
https://github.com/adityatelange/hugo-PaperMod/tree/master (as of 2023/05/23

Error message

~/path/to/project$ hugo --panicOnWarning
Start building sites …
hugo v0.112.0-0a95d6704a8ac8d41cc5ca8fffaad8c5c7a3754a+extended linux/amd64 BuildDate=2023-05-23T08:14:20Z VendorInfo=gohugoio
WARN 2023/05/23 11:55:27 .Language.Params is deprecated and will be removed in a future release. .Language.Params is deprecated and will be removed in a future release. Use site.Params instead.

  • For all but custom parameters, you need to use the built in Hugo variables, e.g. site.Title, site.LanguageCode; site.Language.Params.Title will not work.
  • All custom parameters needs to be placed below params, e.g. [languages.en.params] in TOML.

See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120

Total in 3873 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/path/to/project/themes/PaperMod/layouts/_default/single.html:39:26": execute of template failed: template: _default/single.html:39:26: executing "main" at <.Language.Params.Taxonomies.tag>: error calling Params: Warning trapped. Remove the --panicOnWarning flag to continue.

@darrenkearney darrenkearney added the bug Something isn't working label May 23, 2023
@darrenkearney
Copy link
Author

darrenkearney commented May 23, 2023

I've a PR incoming that addresses this issue, but there is one consideration - the minimum version of Hugo that this project seeks to support.

Addressing the deprecation issue may well require incrementing the minimum version of Hugo from v0.97.1 to v0.112.0.

If increasing the minimum supported version of Hugo is a consideration that the hugo-PaperMod authors and contributors do not plan to support at the current moment, please feel free to ignore this issue for a while.

darrenkearney added a commit to darrenkearney/hugo-PaperMod that referenced this issue May 23, 2023
Changed site variables from 'Language.Params' -> 'Site.Params'
Note this change may conflict with hugo versions less than v0.112.0

See hugo docs:
  https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120

See hugo-PaperMod Issue:
  adityatelange#1224

	modified:   _default/single.html
	modified:   partials/header.html
@darrenkearney
Copy link
Author

Pull Request here: #1225

@adityatelange
Copy link
Owner

Looks like bep had second thoughts on this: gohugoio/hugo#11025

No longer a warning after 0.112.4

Originally posted by @SirUli in #1225 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants