If a shortcode has this
{{ if isset .Params "project_url" }}
{{ warnf "foo" }}
{{ end }}
then there’s an error on the isset .Params
line
"/Users/me/Developer/project/exampleSite/content/blog/my-shortcode.md:17:1": failed to render shortcode "myshortcode": failed to process shortcode: "/Users/me/Developer/project/layouts/shortcodes/project/myshortcode.html:42:6": execute of template failed at <isset .Params "project_url">: error calling isset: isset unable to use key of type string as index
even though this is straight out of the isset documentation:
{{ if isset .Params “project_url” }} {{ index .Params “project_url” }}{{ end }}
If you change
{{ if isset .Params "project_url" }}
to
{{ if isset .Page.Params "project_url" }}
then it works.
Env:
$ hugo env
hugo v0.110.0+extended darwin/amd64 BuildDate=unknown
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.19.5"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.2.4"