Using isset on shortcode .Params causes error

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"

.Params within the context received by a shortcode is an array of the positional or named shortcode parameters. If you call the shortcode without any parameters, .Params is nil.

.Page.Params within the context received by a shortcode refers to front matter parameters.

https://gohugo.io/templates/shortcode-templates/#params

I think .Params is a map, isn’t it?

In my case, there were other params set, so .Params wasn’t nil. Even if .Params was nil, “isset unable to use key of type string as index” wouldn’t be a good explanation of the problem.

Here’s the original context:

Changing

{{ if and (ne $byline nil) (ne $byline "") }}

to

{{ if isset .Params "byline" }}

will cause the error.

Edit: Fixed the example changed code.