From 165c7593a99119696f3d72f9d78fece159841d0a Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Tue, 7 Oct 2025 22:06:09 +0200 Subject: [PATCH] Fix Hugo compatibility: handle nil File objects in footer --- layouts/partials/flex/body-aftercontent.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/layouts/partials/flex/body-aftercontent.html b/layouts/partials/flex/body-aftercontent.html index fc7b550..3d902bd 100644 --- a/layouts/partials/flex/body-aftercontent.html +++ b/layouts/partials/flex/body-aftercontent.html @@ -37,9 +37,14 @@
{{ $footer := print "_footer." .Lang }} - {{ range where .Site.Pages "File.BaseFileName" $footer }} - {{ .Content }} - {{else}} + {{ $found := false }} + {{ range .Site.Pages }} + {{ if and .File (eq .File.BaseFileName $footer) }} + {{ .Content }} + {{ $found = true }} + {{ end }} + {{ end }} + {{ if not $found }} {{ if .Site.GetPage "page" "_footer.md" }} {{(.Site.GetPage "page" "_footer.md").Content}} {{else}}