From 92946d0c39dd5a27ff8c9a403a4f2f3cc2d5ab4a Mon Sep 17 00:00:00 2001
From: koh-sh <34917718+koh-sh@users.noreply.github.com>
Date: Sat, 28 Feb 2026 12:25:24 +0000
Subject: [PATCH] fix: resolve .Site.Author error for Hugo 0.156.0 (#583)
---
layouts/_default/rss.xml | 28 +++++++++++--
.devcontainer/Dockerfile | 4 +-
layouts/partials/schema.html | 11 +++++
layouts/partials/head.html | 16 ++++++-
netlify.toml | 4 +-
layouts/partials/footer.html | 12 +++++
6 files changed, 61 insertions(+), 14 deletions(-)
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 57d9a9a..cafce62 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -5,9 +5,9 @@
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
ARG VARIANT=hugo_extended
# VERSION can be either 'latest' or a specific version number
-ARG HUGO_VERSION="0.147.8"
+ARG HUGO_VERSION="0.157.0"
-ARG DART_SASS_VERSION="1.89.2"
+ARG DART_SASS_VERSION="1.97.3"
# Download Hugo
RUN apt-get update && apt-get install -y ca-certificates openssl git curl && \
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index b926875..45c5ee8 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -1,3 +1,21 @@
+{{- $authorEmail := "" -}}
+{{- with site.Params.author -}}
+ {{- if reflect.IsMap . -}}
+ {{- with .email -}}
+ {{- $authorEmail = . -}}
+ {{- end -}}
+ {{- end -}}
+{{- end -}}
+{{- $authorName := "" -}}
+{{- with site.Params.author -}}
+ {{- if reflect.IsMap . -}}
+ {{- with .name -}}
+ {{- $authorName = . -}}
+ {{- end -}}
+ {{- else -}}
+ {{- $authorName = . -}}
+ {{- end -}}
+{{- end -}}
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
@@ -17,9 +35,9 @@
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
- <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
- <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
- <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
+ <language>{{.}}</language>{{end}}{{ with $authorEmail }}
+ <managingEditor>{{.}}{{ with $authorName }} ({{.}}){{end}}</managingEditor>{{end}}{{ with $authorEmail }}
+ <webMaster>{{.}}{{ with $authorName }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
@@ -30,7 +48,7 @@
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
- {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
+ {{ with $authorEmail }}<author>{{.}}{{ with $authorName }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
{{ if eq .Site.Params.rssFullContent true }}
<description>{{ .Content | html }}</description>
@@ -42,4 +60,4 @@
</item>
{{ end }}
</channel>
-</rss>
\ No newline at end of file
+</rss>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index a15f337..74c2473 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,3 +1,13 @@
+{{- $authorName := "" -}}
+{{- with .context.Site.Params.author -}}
+ {{- if reflect.IsMap . -}}
+ {{- with .name -}}
+ {{- $authorName = . -}}
+ {{- end -}}
+ {{- else -}}
+ {{- $authorName = . -}}
+ {{- end -}}
+{{- end -}}
<footer class="footer footer__{{ .footerClassModifier }}">
<ul class="footer__list">
<li class="footer__item">
@@ -5,7 +15,7 @@
{{ if isset .context.Site.Params "copyright" }}
{{ replace .context.Site.Params.copyright "{{ YEAR }}" (now.Format "2006") | markdownify }}
{{ else }}
- {{ .context.Site.Params.author }}
+ {{ $authorName }}
{{ now.Format "2006" }}
{{ end }}
</li>
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 70fbe93..c9e508f 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,13 +1,23 @@
<head>
<meta charset="utf-8" />
+ {{- $authorName := "" -}}
+ {{- with .Site.Params.author -}}
+ {{- if reflect.IsMap . -}}
+ {{- with .name -}}
+ {{- $authorName = . -}}
+ {{- end -}}
+ {{- else -}}
+ {{- $authorName = . -}}
+ {{- end -}}
+ {{- end -}}
<title>
{{ if (eq .Site.Params.reversepagetitle true) }}
{{ with .Title }}
{{ . }} |
{{ end }}
- {{- .Site.Params.author -}}
+ {{- $authorName -}}
{{ else }}
- {{- .Site.Params.author -}}{{ with .Title }}
+ {{- $authorName -}}{{ with .Title }}
|
{{ . }}
{{ end }}
@@ -19,7 +29,7 @@
<!-- Meta -->
{{- hugo.Generator -}}
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover" />
- <meta name="author" content="{{ .Site.Params.author }}" />
+ <meta name="author" content="{{ $authorName }}" />
<meta
name="description"
content="{{ if .Params.description }}
diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html
index 9385afe..52c3338 100644
--- a/layouts/partials/schema.html
+++ b/layouts/partials/schema.html
@@ -15,7 +15,16 @@
}
</script>
{{ else if .IsPage }}
- {{ $author := or (.Params.author) (.Site.Params.author) }}
+ {{- $author := "" -}}
+ {{- with or (.Params.author) (.Site.Params.author) -}}
+ {{- if reflect.IsMap . -}}
+ {{- with .name -}}
+ {{- $author = . -}}
+ {{- end -}}
+ {{- else -}}
+ {{- $author = . -}}
+ {{- end -}}
+ {{- end -}}
{{ $favicon := .Site.Params.favicon | absURL }}
<script type="application/ld+json">
{
diff --git a/netlify.toml b/netlify.toml
index 599eb5e..a05d75a 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -10,8 +10,8 @@
"""
[build.environment]
- HUGO_VERSION = "0.147.8"
- DART_SASS_VERSION = "1.89.2"
+ HUGO_VERSION = "0.157.0"
+ DART_SASS_VERSION = "1.97.3"
NODE_VERSION = "22"
GO_VERSION = "1.24.3"
HUGO_ENV = "production"
--
Gitblit v1.10.0