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

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

Closed
steven-geo opened this issue Jun 1, 2024 · 6 comments · Fixed by #375
Closed

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

steven-geo opened this issue Jun 1, 2024 · 6 comments · Fixed by #375
Labels

Comments

@steven-geo
Copy link

steven-geo commented Jun 1, 2024

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
Copy link
Owner

Vimux commented Jun 3, 2024

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
Copy link

note4 commented Jun 18, 2024

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
Copy link
Owner

Vimux commented Jun 19, 2024

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
Copy link

.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
Copy link
Author

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.

@steven-geo steven-geo changed the title Deprecated .Site.IsServer causing build WARNING Deprecated .Site.IsServer causing build WARNING (ERROR in v0.133.0) Aug 13, 2024
kanedafromparis added a commit to parisjug/parisjug-website that referenced this issue Aug 13, 2024
@Vimux Vimux added the bug label Aug 20, 2024
Vimux added a commit that referenced this issue Aug 20, 2024
As of Hugo 0.120.0, `.Site.IsServer` is deprecated, and starting with Hugo 0.132.0, it causes a build error. Unfortunately, this is a breaking upstream change that we can't "fix" on our end. As a result, we had to raise the minimum supported version to v0.54.0 and implement another workaround to ensure compatibility with older versions, not just Hugo v0.120.0 and all subsequent versions.

Fix #369
@Vimux Vimux closed this as completed in 86f1b19 Aug 20, 2024
@Vimux
Copy link
Owner

Vimux commented Aug 20, 2024

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.

nikolaswise pushed a commit to nikolaswise/Mainroad that referenced this issue Dec 20, 2024
As of Hugo 0.120.0, `.Site.IsServer` is deprecated, and starting with Hugo 0.132.0, it causes a build error. Unfortunately, this is a breaking upstream change that we can't "fix" on our end. As a result, we had to raise the minimum supported version to v0.54.0 and implement another workaround to ensure compatibility with older versions, not just Hugo v0.120.0 and all subsequent versions.

Fix Vimux#369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants