Migrating beautifulhugo from Legacy to Current: Dark Mode, Search and TOC

Redoing the theme upgrade in stages after the first attempt was reverted in 34 minutes

When I looked into the beautifulhugo repository, I noticed that the current master (referred to as the current version below), which is separate from the legacy version I have been using, bundles dark mode, search and a table of contents (TOC) all together. I had actually tried once before, in a commit called “Update Beautifulhugo”, to bump only the pin in go.mod, but 34 minutes later I reverted it. The commit log does not record what happened, but at that time I swapped only the pin without thinking about things like the breaking changes from Bootstrap 3 to 5, so the display probably broke and I rolled it back immediately. This time, as a rematch, I decided to redo the migration from the legacy version to the current version in separate stages. [Read More]

Updating Hugo and My Beautifulhugo Theme After a Year Away

Theme update and site improvements

Somehow this is my first post in a long time, and before I knew it more than a year had passed without an update. (^_^;) Lately I have been doing vibe coding with generative AI, so I had no time to write articles. As for the Hugo behind this blog, if I do not keep it updated then changes in its features start causing problems, so I updated it. While I was updating Hugo, I also changed the look of the Beautifulhugo theme. For the changes as well, making use of generative AI these days keeps the coding moving along easily. [Read More]

Migrating the Beautifulhugo Theme from a Git Submodule to Hugo Modules

Learn how to transition your Beautifulhugo theme from submodules to Hugo Modules.

Up to now I had been using Hugo’s Beautifulhugo theme on this site as a submodule, but I switched it over to the hugo modules format. Environment I work by cloning my own repository from Github. First, a look at the local environment Copy ❯ go version go version go1.22.6 darwin/arm64 ❯ hugo version hugo v0.131.0+extended darwin/arm64 BuildDate=2024-08-02T09:03:48Z VendorInfo=brew The theme is beautifulhugo, installed as a submodule Initialising hugo modules Copy $ hugo mod init github.com/user/scribble go: creating new go.mod: module github.com/user/scribble go: to add module requirements and sums: Fetching the beautifulhugo theme [Read More]

Fixing the Unresponsive Hamburger Menu in Hugo's Tranquilpeak Theme

how I got a Hamburger/Toggle menu to work on tranquilpeak at subpath

I suspect the symptom had been happening for a while, but I noticed that the hamburger menu displayed in responsive mode on the Hugo theme “Tranquilpeak” was not working, and I ended up spending almost a whole day tracking down and understanding the cause. The symptom With this phenomenon, there was no problem as long as BaseURL was the top directory; it occurred when a subpath (subdirectory) was configured. Specifically, [Read More]

Updating the Hugo Tranquilpeak Theme from 0.4 to 0.5

how to update tranquilpeak-theme for 0.4 to 0.5

I updated the Hugo Tranquilpeak theme on a site I run elsewhere from 0.4.x to 0.5.x From 0.5BETA onwards a number of fixes were required, so here are my notes The current Tranquilpeak The theme is managed as a submodule, and I was using 0.4.x Copy $ pwd ~/hugo/tranquilpeak $ git submodule status e1d2c5d5cb1efb687ed698782f99df576e7db084 themes/tranquilpeak (0.4.8-BETA) Updating to 0.5-BETA Copy $ git submodule update --remote remote: Enumerating objects: 496, done. remote: Counting objects: 100% (493/493), done. remote: Compressing objects: 100% (164/164), done. remote: Total 496 (delta 308), reused 472 (delta 296), pack-reused 3 Receiving objects: 100% (496/496), 214.68 KiB | 7.95 MiB/s, done. Resolving deltas: 100% (308/308), completed with 90 local objects. From https://github.com/kakawait/hugo-tranquilpeak-theme e1d2c5d..37550aa master -> origin/master + 4243bcf...8223447 develop -> origin/develop (forced update) * [new branch] fix-fancybox-3-data-model -> origin/fix-fancybox-3-data-model a065336..902f360 gh-pages -> origin/gh-pages * [new tag] 0.5.0-BETA -> 0.5.0-BETA Submodule path 'themes/tranquilpeak': checked out '37550aa165eec033e34f2e0f89cb0720d72a4c34' Changes and key points To show posts on the front page, mainSection has to be specified explicitly (I was showing the list of posts on the front page, so nothing appeared unless mainSection was filled in) highlight, jQery, prism and font-awesome have each been upgraded, so entries that load the CDN URLs via [[params.customJS]] are needed The notation changed because font-awesome went from 4 to 5 (v5 notation) A timezone parameter was added in hugo0.87, so I added timezone = "Asia/Tokyo" (it is not mandatory, and you need to have updated hugo to 0.87 or later) Fixing config.toml The quickest way is to copy the config.toml inside themes/tranquilpeak/exampleSite and change only the parts you need [Read More]

Notes on Updating a Hugo Theme Managed as a Git Submodule

How to update submodule theme

On this site I manage the Hugo Beautifulhuigo theme as a submodule on Gitlab. From time to time the upstream submodue theme gets updated, but git clone and git push do not update the submodule automatically So it has to be updated by hand, and since this is work I do often, I am writing it down as a note Cloning my own repository Copy $ git clone --recurse-submodules --depth 1 https://gitlab.com/user/repo.git $ cd repo Updating the submodule The only thing you actually have to do is git submodule update --remote [Read More]

How to Hide the Author Name in the Beautifulhugo Theme

how to remove author name

On this site there is only one administrator, so going to the trouble of showing the author (Author name) has no meaning. Setting the Author field to display:none; with CSS might remove only the display, but since it is unnecessary I thought I might as well delete it outright. Looking into the files right away, I found it written in theme/beautifulhugo/layouts/partials/post_meta.html. Copy {{ if not .Site.Params.hideAuthor }} {{ if .Params.author }} &nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Params.author | safeHTML }} {{ else }} &nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Site.Author.name | safeHTML }} {{ end }} {{ end }} Usually I would delete the relevant part and bring it over to root/layouts/partials/post_meta.html, but looking closely, the condition is the truth value of hideAuthor. [Read More]

Beautifulhugo Stops Showing the Last Modified Date on Hugo 0.76 and Later

Failed to get translated string for language "ja" and ID "lastModified": template: :1:22: executing "" at <.Count>: can't evaluate field Count in type string

Beautifulhugo is the Hugo theme I still use today, and a symptom where the last modified date was not displayed showed up, so I dealt with it Incidentally, the hugo version is 0.80.0 Symptoms When I start the server locally, the last modified date is not displayed and the error below appears Copy $ hugo server -D .... Failed to get translated string for language "ja" and ID "lastModified": template: :1:22: executing "" at <.Count>: can't evaluate field Count in type string Since I deploy with Netlify, raising the hugo version in netlify.toml produces the same symptom Copy ... [context.production.environment] HUGO_VERSION = "0.80.0" HUGO_ENV = "production" HUGO_ENABLEGITINFO = "true" Cause Looking at the error message, the <.Count> notation seems to be the problem, and it is used in en.yaml, ja.yaml and the like inside beautifulhugo/i18n/. [Read More]