Help with errors

Hi Hugo Community,

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"

Link to my github repo

I have two questions:

  1. How to fix the errors? I get that I have to change something on my config.toml but would appreciate help with this.
  2. Since the ‘Introduction’ theme doesn’t appear to be updated anymore, would it be better to change themes in the near future?

Thank you!

I think, looking at your repo, that the developer of the theme is on a newer Hugo version than you.

Try updating your Hugo and the theme itself. The error for google_analytics_async.html should go away then (it was fixed here).

If the first two errors are still coming up after updating the theme:

  • search for .Site.IsServer and replace with hugo.IsServer
  • search for .Site.DisqusShortname and replace with site.Config.Services.Disqus.Shortname

Two years is a lot of life time for Hugo, so expect more issues to come up.

Also, please post the output of hugo version if you have any other question so we can be sure what version you are on.

Isn`t tht the other way round?

The new computer uses a new hugo version and the 2y old theme is not compatible.

At least the live site at baseURL is build using

<meta name="generator" content="Hugo 0.91.2" />

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.

1 Like

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?

The Hugo Version I’m on is hugo v0.134.0+extended

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 :slight_smile:

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.

1 Like

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.

Re changing the theme - that makes sense :grinning:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.