Vimux / Mainroad

Responsive, simple, clean and content-focused Hugo theme based on the MH Magazine lite WordPress theme
https://mainroad-demo.netlify.app/
GNU General Public License v2.0
912 stars 461 forks source link

Deprecated .Site.IsServer causing build WARNING (ERROR in v0.133.0) #369

Closed steven-geo closed 1 month ago

steven-geo commented 4 months ago

Version v0.126.2

hugo warning: WARN deprecated: .Site.IsServer was deprecated in Hugo v0.120.0 and will be removed in a future release. Use hugo.IsServer instead.

As I use hugo --panicOnWarning, this blocks all CICD deployments from running successfully.

layouts/_default/_baseof.html Line 38 needs to change from: {{- if not .Site.IsServer }} To: {{- if not hugo.IsServer }}

Vimux commented 4 months ago

Line 38 needs to change from: {{- if not .Site.IsServer }} To: {{- if not hugo.IsServer }}

This is a breaking change. Similar deprecated log messages from Hugo have been discussed before in #364. My opinion hasn't changed since then.

note4 commented 3 months ago

Line 38 needs to change from: {{- if not .Site.IsServer }} To: {{- if not hugo.IsServer }}

This is a breaking change. Similar deprecated log messages from Hugo have been discussed before in #364. My opinion hasn't changed since then.

Totally agree with Vimux. But I am confused now. How can I install Mainroad using the latest version of hugo to avoid errors and build normally?

Vimux commented 3 months ago

How can I install Mainroad using the latest version of hugo to avoid errors and build normally?

Mainroad works with the latest version of Hugo (v0.127.0). I don't see build errors when using the latest version of Hugo. It builds as it should.

rimas-kudelis commented 1 month ago

.Site.IsServer is now causing an error in Hugo 0.132.0:

Watching for changes in /src/{archetypes,assets,content,i18n,layouts,static,themes}
Watching for config changes in /src/config.yaml
Start building sites … 
hugo v0.132.0-005e895a386e59dd38418066b3280fd98a33c96b+extended linux/amd64 BuildDate=2024-08-12T15:21:36Z VendorInfo=hugomods

ERROR deprecated: .Site.IsServer was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.133.0. Use hugo.IsServer instead.
Built in 46 ms
Error: error building site: logged 1 error(s)
steven-geo commented 1 month ago

Looks like this is about to go from a warning to an ERROR, so needs to be attended to. I take the view that we should cater for new users more as if new users get warnings and errors they are more likely to select a different theme that builds without issue. People already using Mainroad, then if they upgrade Mainroad/hugo, they will need to upgrade the theme as well at that time.

Vimux commented 1 month ago

I take the view that we should cater for new users more as if new users get warnings and errors they are more likely to select a different theme that builds without issue.

Mainroad theme is designed for experienced users. I am focusing on collaborating with those who have a solid understanding of Hugo and adhere our guidelines. Additionally, I am unable to offer free personal support. Therefore, I would sincerely appreciate if users with minimal exprerience consider exploring alternative themes that may better suit their needs. Thank you.