If isset .Scratch.Get "my_var"

Hello. How can I check if the variable “my_var” is set?

You can use .Scratch.Get and then with to use it:

{{ $var := .Scratch.Get "my_var" }}
{{ with $var }}
  // do something with {{ . }} in place of $var
{{ end }}

Failed to render pages: render of "page" failed: execute of template failed: template: _default/ddos-protection.html:91:3: executing "_default/ddos-protection.html" at <partial "modules/orange_banner" .>: error calling partial: "W:\site\src\themes\my_theme\layouts\partials\modules\orange_banner.html:13:51": execute of template failed: template: partials/modules/orange_banner.html:13:51: executing "partials/modules/orange_banner.html" at <.Scratch.Get>: can't evaluate field Scratch in type template.HTML

Doesn’t work :frowning:

It does, but you need to get your “dot” right.