halogenica / beautifulhugo

Theme for the Hugo static website generator
Other
1.13k stars 601 forks source link

Require Hugo 0.120+, fix deprecation warnings #502

Closed hydr0nium closed 1 month ago

hydr0nium commented 1 month ago

I changed the parameter .site.IsServer parameter to hugo.isServer because the first one is deprecated.

henryiii commented 1 month ago

Any idea of how far back the new one works?

henryiii commented 1 month ago

New in 0.120 https://gohugo.io/functions/hugo/isserver/

Did they have to deprecate the same version they added the replacement?

henryiii commented 1 month ago

Eh, we are on 0.128 now, so I'd be okay with making 0.120 the minimum, I think. Anyone else?

hydr0nium commented 1 month ago

@henryiii

I would say that being basically 8 versions ahead of the deprecated function is enough.


I also found another deprecated feature .Site.DisqusShortname which also got deprecated since 0.120. If we change to 0.128 0.120 we can also update that as well.

henryiii commented 1 month ago

Can we make it a hard error (errorf) if too old?

hydr0nium commented 1 month ago

Could we use the min_version parameter in the theme.toml and HUGO_VERSION in netlify.toml file?

hydr0nium commented 1 month ago

Other than that we could maybe use the errorf and the hugo.Version function to check if a specific version is used. Just don't know where we would put it

henryiii commented 1 month ago

The theme.toml one sounds good. I assume Hugo would error with a nice message if that was too high.

hydr0nium commented 1 month ago

The theme.toml one sounds good. I assume Hugo would error with a nice message if that was too high.

I did some tests and changing theme.toml would result in telling the user that they are using the wrong version. The problem is though that it does not stop the build.

Maybe adding another check in something like the baseof.html with the hugo.Version and errorf would be a second measure to stop the build.

henryiii commented 1 month ago

Would you mind rebasing or merging to resolve conflicts? Then I'll trigger the CI.

henryiii commented 1 month ago

Thanks for pushing this through!