Open skrysmanski opened 10 months ago
After some more digging I found out that my code was (mistakenly) looking for exporting_classes
(underscore) but should have been looking for exporting-classes
(dash).
But still I'd argue that looking up a non-existing key shouldn't crash hugo server.
No problem:
{{ $h := .Fragments.HeadingsMap.bad_id }}
{{ if $h }}
{{ end }}
Also no problem:
{{ $h := index .Fragments.HeadingsMap "bad_id" }}
This panics:
{{ $h := index .Fragments.HeadingsMap "bad_id" }}
{{ if $h }}
{{ end }}
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
Bug Report
When running Hugo as server, I'm getting this error (I'm not getting this error when just executing
hugo
):The panic is caused by the
if $targetHeading
condition from within the link render hook (render-link.html
):The value for
$url.Fragment
here is"exporting_classes"
.The value for
.Fragments.HeadingsMap
is: