Fix Hugo compatibility: handle nil File objects in footer

This commit is contained in:
Christoffer Martinsson 2025-10-07 22:06:09 +02:00
parent 288932b4af
commit 165c7593a9

View File

@ -37,9 +37,14 @@
<div>
{{ $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}}