First, when using with
, the context (aka “the dot”) is rebound to its scope. For example:
{{- $var := "foo: -}}
{{- with $var -}}
{{ . }}
{{- end -}}
will emit foo
.
See:
https://gohugo.io/templates/introduction/#the-dot
https://gohugo.io/functions/with/
Second, neither with
nor isset
will do what you need, but this will:
{{- if $.GitInfo -}}
{{ .GitInfo.Subject }}
{{- end -}}
This was not intuitive. I found it here: https://github.com/gohugoio/hugo/issues/4184.
Finally, at least for me, this is a non-issue if all of my content is under source control. It sounds like some of yours is not.