Hugo

Restarting Theme Development

This post is a bit of a ramble and more for documenting my thinking.

Things have been kind of hectic in my personal life and I’ve been taking a step away from creating and interacting. In the time that I’ve been away, there have been changes to Hugo and the Micro.blog. In some ways, it’s been a relief that Micro.blog is using v0.117. Other than the changes in v0.132 (The introduction of alerts although v0.140 and v0.142 has some significant fixes to this), I haven’t really seen anything catches my interest.

Still, I have seen some interesting things being done with blogs and want to be able to take advantage of the newer versions of Hugo when Manton and crew make it available.

I thought I would document what steps I went through. I’ve begun writing this on September 24th and worked on it in my spare time until clicking the publish button.

Environmental Setup

At the beginning of this process, I had Hugo v0.146.3 installed on my MacBook Air running Tahoe 26.1. I want to be able to test in different versions of Hugo so did a search and found several article pointing to hvm (Hugo Version Manager). The tool was created by Joe Mooring who is very active on the Hugo Forums and you can go to the GitHub repository to review the code.

The first thing I did was use Kostas’ instructions for using brew to get a certain version of running a specific version of Hugo and then I downloaded the v.117 hugo ruby installer.

That didn’t work.

So, I downloaded the homebrew-core from the GitHub repository and then changing to the commit that has the version I want.

git checkout e243fd4

That didn’t work for me as well and I grew tired of trying to find the right combinations of brew commands.

So, I followed the directions and ran the next step to see an error

mandaris@skylite ~ % hvm gen alias --help
zsh: command not found: hvm

That’s when I realized that my system is almost a clean install other than the installation of the command line tools and brew, I didn’t have things like /usr/local/bin or anything else that I had taken from granted in my previous setup.

I set up oh-my-zsh and kept the defaults. I forgot why I use this but not how. I added the following to my .zshrc

export PATH=$PATH:$(go env GOPATH)/bin

Then new shell instances will be able to find the executables from GO.

➜  ~ which hvm
/Users/mandaris/go/bin/hvm

When I ran it the first time, I didn’t see my option and asked on the forums before I went through the associated documents to see that I could add the specific version to a .hvm file that I can put in the root of the folder I’m working with.

➜  local-hugo hvm status
The current directory is configured to use Hugo v0.117.0.
Cached versions of the Hugo executable:

v0.151.0
v0.117.0

Now I’m able to switch between the versions easily.

The only problem is that some of the plugins that I use locally are not compatible with that version. For example, the stoot plugin to embed mastodon post.

Hashtag Goals

Other than the work to keep the theme ready for newer versions of Hugo, I’ve identified a couple other things that I want to work on.

  1. Increase the performance of the site
    I don’t want to remove styling or minimize the file because I feel that it will help others learn and I’m too afraid to kill my darlings.
  2. Move the About me to the bottom
    I feel having it on the side on larger screens draws focus away from the writing on page.

In addition, I have to figure out why @view-transition doesn’t work on the server but works on my local copy of the site.

The goal is to get this all finished before Thanksgiving break. So if you’re reading this please feel free to bug me about it as my self imposed deadline draws near.

Take Care!

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. ↩︎