Skip to main content

Hugo

I'm tired boss... upcoming deprecations

I've been working on an update for my website theme to scratch a technical curiosity I was feeling related to authorship of individual posts in comparison to the entire site. After reading a couple resources, I decided to ask on the Hugo forums if there was an ideal way to add author information. I kept running into an issues and figured that it might be related to the version change.

Hugo deprecation warning
Warnings are future errors. A technical debt for waiting to come due.

Here are the warning messages if you want to read over them.

WARN  The "gist" shortcode was deprecated in v0.143.0 and will be removed in a future release. See https://gohugo.io/shortcodes/gist for instructions to create a replacement.
WARN  The "twitter", "tweet", and "twitter_simple" shortcodes were deprecated in v0.142.0 and will be removed in a future release. Please use the "x" shortcode instead

I have flashbacks of when I was working with another static site generator called Pelican that I enjoyed for many years until one day I did an update1 that took the site down because I had to find fixes for all the different components that weren’t working anymore.

On some levels, I understand that I don’t need to upgrade and that’s part of why I’m on my current hosting provider. The point of my blog is to communicate with the World Wide Web, get my thoughts together, and fulfill that part of me that likes to create. I feel that some of the things that I create for this blog are only used during the creation and never utilized afterwards.

What’s frustrating about these warnings are they are related to shortcodes built into Hugo itself. They are part of the documentation and examples that Hugo has to showcase what the project can do. I feel that it’s a real help when writing an article to avoid pasting the larger and larger code blocks used to embed something into a post. But with the changing technical and political landscapes, I can see why these changes are coming.

I’m sad.

Further bitrot.

I’ve already removed most if not all of the twitter links on my site and based on the last time I checked traffic, no one was reading it anyway. The gist changes are a little sadder for me because I was using them as reference in some of my favorite posts and I feel that people still read those.

But, I’m not updating the version today

The current version on the server is 0.117 and that’s been really solid. There is a version .140 that’s available but I wasn’t able to get it working.

Problem for stoot

I was able to take a code sample from Bryce last year and make it a plugin for Micro.blog users and I named it stoot after the shortcode that Bryce used for it. Unfortunately, it’s now giving me an error in my local environment.

The following is a truncated snippet of the error.

ERROR render of "/" failed: failed to render shortcode "stoot": failed to process shortcode: "/Users/mandaris/Code/local-hugo/themes/stoot/layouts/shortcodes/stoot.html:13:28": execute of template failed: template: _shortcodes/stoot.html:13:28: executing "_shortcodes/stoot.html" at <$urlToGet>: can't evaluate field Err in type resource.Resource
---
toot.html:13:28: executing "_shortcodes/stoot.html" at <$urlToGet>: can't evaluate field Err in type resource.Resource: Resource.Err was removed in Hugo v0.141.0 and replaced with a new try keyword, see https://gohugo.io/functions/go-template/try/

And yes, it did say toot.html even though it was from stoot.html. One problem at a time!!

The code in question:

{{- with resources.GetRemote $urlToGet  -}}
	{{ if (resources.GetRemote $urlToGet).Err }}

Next action(s)

I’ve decided that my next actions will be the following.

  1. Ignore the gist issue. It’s marked for a future release and there are directions on how to replace it. I have a about a handful of examples in my test suite of content (mostly the same code but on different pages)
  2. Learn how to keep multiple copies of Hugo local so that I can test this kind of thing easier.
  3. Learn how get replacement to work according to the error message.

  1. I took it for granted that a project would just work better after and upgrade; all reward and no consequences. You should not only backup your content but the environment. Look at how much work people maintain game emulators do in order to keep their backups running. ↩︎