In my main layout file I’d like to do something like this for the HTML title tag:
{{if isset "title" }}
<title>{{template "title"}} - {{ .SiteTitle }}</title>
{{else}}
<title>{{ .SiteTitle }}</title>
{{end}}
But the isset portion doesn’t seem to be a part of the base HTML Template package (I heard about it via a page from the Hugo website so I figure it’s a special addition they’ve added to their templating language).
I’ve also tried using “eq” instead of isset, but it didn’t appear to have the behavior I was wanting either.
Basically, in my sublayout file I want to be able to define a title (or not) that gets tacked onto the front of the Site Title automatically. If the title is not defined, then it should just display the main Site Title.
I felt it would be a bit easier, but I haven’t seen a good example of this yet so far and the documentation doesn’t seem to cover the syntax in depth for me to try and figure out on my own.
Any tips or links to additional resources is much appreciated!
Thank you!