I learned from the docs that:
you can use any object as cache key(s)
Great! So I did this in baseof.html
:
{{- partialCached "javascript.html" . .Params.has_recaptcha -}}
That has_recaptcha
front matter variable is set like so:
has_recaptcha: true
Unfortunately Hugo cannot handle this:
ERROR 2020/04/27 16:57:23 render of "page" failed:
"C:\site\layouts\_default\baseof.html:9:12": execute of
template failed: template: _default/single.html:9:12: executing
"_default/single.html" at <partialCached "javascript.html" .
.Params.has_recaptcha>: error calling partialCached:
runtime error: invalid memory address or nil pointer dereference
How can I fix that runtime error?
Hugo Static Site Generator v0.69.2-EC9DCF30 windows/amd64 BuildDate: 2020-04-24T07:51:17Z
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.14.1"