The-Balance-FFXIV / glam

A hugo theme for the balance
Other
5 stars 24 forks source link

Update deprecated .Site.IsServer to hugo.IsServer #396

Closed VioletHynes closed 2 weeks ago

VioletHynes commented 2 weeks ago

It seems like .Site.IsServer was deprecated in Hugo 0.120, and as a result you're unable to build with modern versions. Changing to hugo.IsServer seems to work great. This was the only change I needed to make to get it to work locally.

Before:

violet@damsel-of-distress:~/Repositories/balance-static$ hugo server --disableFastRender
Watching for changes in /home/violet/Repositories/balance-static/{archetypes,content,data,layouts,package.json,postcss.config.js,static,tailwind.config.js,themes}
Watching for config changes in /home/violet/Repositories/balance-static/config.toml
Start building sites …
hugo v0.134.1-2f89169baa87a9db47e288b60705f4e99e21a945+extended linux/amd64 BuildDate=2024-09-05T10:17:50Z VendorInfo=snap:0.134.1

ERROR deprecated: .Site.IsServer was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.135.0. Use hugo.IsServer instead.
Built in 823 ms
Error: error building site: logged 1 error(s)

After:

violet@damsel-of-distress:~/Repositories/balance-static$ hugo server --disableFastRender
Watching for changes in /home/violet/Repositories/balance-static/{archetypes,content,data,layouts,package.json,postcss.config.js,static,tailwind.config.js,themes}
Watching for config changes in /home/violet/Repositories/balance-static/config.toml
Start building sites …
hugo v0.134.1-2f89169baa87a9db47e288b60705f4e99e21a945+extended linux/amd64 BuildDate=2024-09-05T10:17:50Z VendorInfo=snap:0.134.1

                   |  EN
-------------------+-------
  Pages            |  371
  Paginator pages  |    0
  Non-page files   |    0
  Static files     | 1346
  Processed images |    0
  Aliases          |   15
  Cleaned          |    0

Built in 2014 ms
Environment: "development"
Serving pages from disk
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
VioletHynes commented 2 weeks ago

@nonowazu Thanks for the feedback! I updated the min version (I set min version to 0.120.0, which is accurate) and the version in the PR creation GitHub workflow. I set the GitHub workflow action to 0.134.2 (the latest version, released a week ago) but I'm happy to adjust to something else if that's too cutting edge.

nonowazu commented 2 weeks ago

Nah, I'm fine with those version changes - in theory, the theme is disconnected from production in terms of how the github workflow is run so testing against latest is a good idea.