From 66e70b3a8106f0a800a6659ffc1ad25c3ac48d15 Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Mon, 2 Mar 2026 16:24:29 +0100 Subject: [PATCH 1/2] chore: adapt to breaking changes in Hugo, update RSS template --- config.toml | 4 +- themes/hugo-sustain/layouts/_default/rss.xml | 72 +++++++++++++++---- .../hugo-sustain/layouts/partials/head.html | 2 +- 3 files changed, 61 insertions(+), 17 deletions(-) diff --git a/config.toml b/config.toml index 12a8b6b..e35bfb1 100755 --- a/config.toml +++ b/config.toml @@ -17,7 +17,6 @@ summaryLength = 50 [params] avatar = "profile.png" - author = "Max Mehl" description = "Open Source expert with background in tech and policy. Focused on strategy, governance, and software supply chains. Building sustainable digital environments." keywords = "open source, free software, Deutsche Bahn, DB Systel, FSFE, management, campaign, communication, strategy, konstanz, berlin, munster, IT service, politics, administration, scouts, founder" @@ -25,6 +24,9 @@ summaryLength = 50 custom_css = ["comments/mastodon-comments.css"] custom_js = ["comments/getcomments.js"] +[params.author] + name = "Max Mehl" + [params.social] Github = "mxmehl" Git = "https://src.mehl.mx/mxmehl" diff --git a/themes/hugo-sustain/layouts/_default/rss.xml b/themes/hugo-sustain/layouts/_default/rss.xml index ef7a711..9ac9c4c 100644 --- a/themes/hugo-sustain/layouts/_default/rss.xml +++ b/themes/hugo-sustain/layouts/_default/rss.xml @@ -1,28 +1,70 @@ -{{ printf "" | safeHTML }} +{{- $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 }} +{{- if or $.IsHome $.IsSection }} +{{- $pages = $pctx.RegularPages }} +{{- else }} +{{- $pages = $pctx.Pages }} +{{- end }} +{{- $limit := .Site.Config.Services.RSS.Limit }} +{{- if ge $limit 1 }} +{{- $pages = $pages | first $limit }} +{{- end }} +{{- printf "" | safeHTML }} {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ with .Title }} ({{.|humanize}}){{ end }}{{ end }} {{ .Permalink }} Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} - Hugo -- gohugo.io{{ with .Site.LanguageCode }} - {{.}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} - {{.}}{{end}}{{ if not .Date.IsZero }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} - {{ with .OutputFormats.Get "RSS" }} - {{ printf "" .Permalink .MediaType | safeHTML }} - {{ end }} - {{ range .Pages }} + Hugo + {{ site.Language.LanguageCode }} + {{- with $authorEmail }} + {{.}}{{ with $authorName }} ({{ . }}){{ end }} + {{- end }} + {{- with $authorEmail }} + {{ . }}{{ with $authorName }} ({{ . }}){{ end }} + {{- end }} + {{- with .Site.Copyright }} + {{ . }} + {{- end }} + {{- if not .Date.IsZero }} + {{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{- end }} + {{- with .OutputFormats.Get "RSS" }} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{- end }} + {{- range $pages }} {{ .Title }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{- with $authorEmail }} + {{.}}{{ with $authorName }} ({{.}}){{end}} + {{- end }} {{ .Permalink }} - {{ .Summary | html }} - {{ .Content | html }} + {{ .Summary | transform.XMLEscape | safeHTML }} + {{ .Content | transform.XMLEscape | safeHTML }} - {{ end }} + {{- end }} diff --git a/themes/hugo-sustain/layouts/partials/head.html b/themes/hugo-sustain/layouts/partials/head.html index 95fa156..1deb62c 100644 --- a/themes/hugo-sustain/layouts/partials/head.html +++ b/themes/hugo-sustain/layouts/partials/head.html @@ -15,7 +15,7 @@ - + {{ with .Site.Params.description }}{{ end }} {{ with .Site.Params.keywords }}{{ end }} From 7c85d3d12edf1afca3c4888862a8e0e5e9adfacf Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Mon, 2 Mar 2026 16:24:52 +0100 Subject: [PATCH 2/2] feat: add mise to configure Hugo version, and add to CI --- .gitea/workflows/hugo.yaml | 12 ++++++------ mise.toml | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 mise.toml diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml index 5ccc4b6..37c7673 100644 --- a/.gitea/workflows/hugo.yaml +++ b/.gitea/workflows/hugo.yaml @@ -33,6 +33,12 @@ jobs: submodules: recursive # Get submdules fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod + - name: Setup required tools (Hugo) + uses: https://github.com/jdx/mise-action@e79ddf65a11cec7b0e882bedced08d6e976efb2d # v3.6.2 + with: + cache: false # no cache on gitea + github_token: ${{ secrets.GH_TOKEN }} + - name: Create configuration for Matomo run: | cp themes/hugo-sustain/static/config.php.sample static/config.php @@ -40,12 +46,6 @@ jobs: sed -i "s|__PROXY_URL__|${{ secrets.MATOMO_PROXY_URL }}|" static/config.php sed -i "s|__TOKEN_AUTH__|${{ secrets.MATOMO_TOKEN_AUTH }}|" static/config.php - - name: Setup Hugo - uses: https://github.com/peaceiris/actions-hugo@v3.0.0 - with: - hugo-version: "0.155.3" - extended: true - - name: Build website with Hugo run: hugo diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..a1c5d1a --- /dev/null +++ b/mise.toml @@ -0,0 +1,2 @@ +[tools] +hugo-extended = "0.157.0"