I’ve been running my site on Hugo for a few years now without issue. I write in markdown, submit a PR to myself, and GitHub actions translate everything to 4 languages, build and deploy the site. Until last week.
I hadn’t done anything with the site in about 6 months when I tried to add a new post. It all went sideways. I’ve been running it down for a few days but here’s where I’m at:
hugo v0.111.3+extended darwin/arm64 BuildDate=unknown
GOOS="darwin"
GOARCH="arm64"
GOVERSION="go1.20.2"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.2.4"
And trying to build my site blows up with:
ERROR 2023/03/30 08:33:44 render of "page" failed: "/Users/davidgs/github.com/DavidgsWeb/themes/davidgs/layouts/_default/baseof.html:33:8":
execute of template failed: template: _default/single.html:33:8:
executing "_default/single.html" at <partial "footer.html" .>:
error calling partial:
"/Users/davidgs/github.com/DavidgsWeb/themes/davidgs/layouts/partials/footer.html:43:20":
execute of template failed: template: partials/footer.html:43:20:
executing "partials/footer.html" at <sort $sections "section.weight">:
error calling sort: can't evaluate an invalid value
So I started poking around and found an answer here that this could be due to a front-matter header missing (I would suspect the weight
value based on the errors, but I cannot find any files that are missing the weight
header for a section.
This is the offending section of the footer.html
partial but I can’t seem to figure out why it’s failing.
{{ if $sections }}
<ul>
{{- range sort $sections "section.weight" }}
{{ if and (.section.enable) (.section.showOnNavbar)}}
{{ $sectionID := replace (lower .section.name) " " "-" }}
{{ if .section.id }}
{{ $sectionID = .section.id }}
{{ end }}
<li class="nav-item">
<a class="smooth-scroll" href="/index.html#{{ $sectionID }}"><img alt="Go To: {{ .section.name }}" src="https://img.shields.io/badge/Go%20To%3A-{{ .section.name }}-blue?style=plastic" loading="lazy"></a>
</li>
{{ end }}
{{- end }}
</ul>
{{ end }}
The whole repo is at GitHub - davidgs/DavidgsWeb: My Public Website and the site is davidgs.com.
Any help appreciated!
dg