I’m moving my website over from my old computer to my new one and I’ve been trying to make sense of the following error(s). I think they are connected but am not sure exactly what I need to update on my end.
ERROR deprecated: .Site.IsServer was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.135.0. Use hugo.IsServer instead.
ERROR deprecated: .Site.DisqusShortname was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.135.0. Use .Site.Config.Services.Disqus.Shortname instead.
ERROR render of "page" failed: "/Users/SmritiDas_1/Desktop/website/themes/introduction/layouts/_default/baseof.html:37:11": execute of template failed: template: blog/single.html:37:11: executing "js-include" at <partial "footer/scripts.html" .>: error calling partial: execute of template failed: html/template:partials/footer/scripts.html:6:12: no such template "_internal/google_analytics_async.html"
Built in 785 ms
Error: error building site: render: failed to render pages: render of "404" failed: "/Users/SmritiDas_1/Desktop/website/themes/introduction/layouts/_default/baseof.html:37:11": execute of template failed: template: 404.html:37:11: executing "js-include" at <partial "footer/scripts.html" .>: error calling partial: execute of template failed: html/template:partials/footer/scripts.html:6:12: no such template "_internal/google_analytics_async.html"
The theme’s Google Integration was fixed two years ago; see this. I’m not sure which “two years ago” came first, hehe, but it seems that the theme version that is submoduled is based on an older commit hash. Regarding the GA integration, it’s probably best to update everything instead of synching old versions of all parts of the issue.
Thanks @davidsneighbour for replying. I’m not the most familiar with Hugo, admittedly. What’s the best way to update Hugo/theme? Do I do this via Git or Netlify?
I am not so versed in using Hugo with Git Submodules, but doing the following “regularly” will update the theme to it’s latest version:
cd themes/themename && git submodule update --remote --merge
It might have to be done differently if you are on a Windows system. Basically go into the theme directory and in there run an update to the latest version. Then go back to your own repository root and git add themes/themename and commit that and your theme integration will be on the last version. Do is either every now and then or when you know you want to update.
Running git status on your repository should/might show you that the themes directory has upstream updates available.
After that, run hugo server and find out if it works fine or if new issues come up. I am pretty sure .Site.IsServer will still come up (this is a newer change) and some newer deprecations will come up. You can mostly just act according to the note in the CLI logs and replace the calls. If you can’t find some get back here and we find them for you
Regarding your initial question of switching to a new theme: you do what you like best. if your website design is good for you the way it is, just keep using that theme and fix issues. The easiest way to fix issues is probably to override them with your own layouts. If a file in themes/themename/layouts/something.html needs a change, then copy it’s content to layouts/something.html in your repo and add your changes here. This will override the file in the theme.
I am not 100% sure if Hugo will continue to complain about deprecations in the themes files though. You could copy the theme files into the theme folder without having them linked as submodule and commit them to your own repo and change directly on those files. In that case you might run into troubles should the original theme ever being updated. It’s a bit of a hassle to copy paste changes over.
Thank you for your help! It’s working now but you are right, .Site.IsServer and .Site.DisqusShortname are both coming up. As I am understanding this correctly, I need to make changes for my config.toml file? I would appreciate the link to the CLI logs.