Skip to Content

Hugo v0.69からv0.75.1へアップデート対応

概要

Hugo version 0.69から0.75.1へアップデートした際のエラーと対応内容

結論

Hugoのバージョンアップデートにあわせてテーマの更新も確認する

アップデート作業

前回のアップデート記録を見直す。
Hugoバージョンアップの備忘録 | infraya.work

久々にHugoをアップデートした。久々のアップグレードだと毎回トラブル対応しており、気が向いた休日しかできない作業である。
brewの更新がとても長いのはPCのせいなのだろうか

1
2
> brew upgrade hugo
==> Upgrading hugo 0.69.0 -> 0.75.1

バージョン確認。

1
2
> hugo version
Hugo Static Site Generator v0.75.1/extended linux/amd64 BuildDate: unknown

案の定、ビルドに失敗してエラーの切り分けがはじまる。

1
2
3
> hugo server -wD

Error: Error building site: failed to render pages: render of "taxonomy" failed: execute of template failed: template: taxonomy/author.terms.html:3:3: executing "taxonomy/author.terms.html" at <partial "header" .>: error calling partial: execute of template failed: template: partials/header.html:3:4: executing "partials/header.html" at <partial "head/head" .>: error calling partial: execute of template failed: template: partials/head/head.html:2:5: executing "partials/head/head.html" at <partial "head/meta" .>: error calling partial: execute of template failed: template: partials/head/meta.html:6:3: executing "partials/head/meta.html" at <partial "head/opengraph" .>: error calling partial: execute of template failed: template: partials/head/opengraph.html:1:38: executing "partials/head/opengraph.html" at <partial "data/title" .>: error calling partial: execute of template failed: template: partials/data/title:14:8: executing "partials/data/title" at <partial "data/author/displayName" .>: error calling partial: execute of template failed: template: partials/data/author/displayName:12:17: executing "partials/data/author/displayName" at <index $.Site.Data.authors ($.Scratch.Get "authorID")>: error calling index: value is nil; should be of type string

テーマのテンプレートが悪そうなので利用しているテーマ(minimo)も更新かけることにした。
MunifTanjim/minimo: Minimo - Minimalist theme for Hugo

ログを確認するとminimo v2.8.0からv2.9.0にあがったことがわかった。

1
2
3
4
5
6
7
8
> pwd
/home/mura/infraya.work/themes/minimo

> git pull origin master
From https://github.com/MunifTanjim/minimo
 * branch            master     -> FETCH_HEAD
Updating d2e08a1..5a6d513
省略

再度トライ!あっさりエラー解消。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
> hugo server -wD
Start building sites …

                   | EN
-------------------+------
  Pages            | 461
  Paginator pages  |  54
  Non-page files   |   0
  Static files     |  19
  Processed images |   0
  Aliases          | 128
  Sitemaps         |   1
  Cleaned          |   0

Netlifyの自動ビルド設定もローカルにHugoのバージョンに合わせて更新。

以前はNetlifyに設定値があることを忘れていた。記憶の外部記録媒体としてブログは役に立つ。
Hugo ローカルサーバとNetlifyにホストされたサイトの表示が異なる | infraya.work

感想

頻繁に更新していればこういったトラブルを避けられるんだろうけど面倒でできていない。4連休だったので久々に対応できただけです。
ブログをはじめて2年弱、セキュリティ対策に時間かけたくないので静的なサイトにしたのは本当に良かった、頻繁にアップデートは面倒くさい。

参考

記事内でリンク済み