collections.IsSet
Reports whether a specific key or index exists in the given map or slice.
Syntax
collections.IsSet MAP|SLICE KEY|INDEX
Returns
bool
Alias
isset
For example, consider this project configuration:
params:
showHeroImage: false
[params]
showHeroImage = false
{
"params": {
"showHeroImage": false
}
}
If the value of showHeroImage is true, we can detect that it exists using either if or with:
{{ if site.Params.showHeroImage }}
{{ site.Params.showHeroImage }} → true
{{ end }}
{{ with site.Params.showHeroImage }}
{{ . }} → true
{{ end }}But if the value of showHeroImage is false, we can’t use either if or with to detect its existence. In this case, you must use the isset function:
{{ if isset site.Params "showheroimage" }}
<p>The showHeroImage parameter is set to {{ site.Params.showHeroImage }}.<p>
{{ end }}When using the isset function you must reference the key using lower case. See the previous example.
Last updated:
February 25, 2026
:
Merge commit '0c2fa2460f485e0eca564dcccf36d34538374922' (b0d3364f1)
Improve this page