In my template, I would like to include some default meta
tags (90% of the time). However, when a specific property is set, I would like to show a different set of text.
I know I can set an anonymous struct
and set a property with either "default"
or "some-x"
. However, this means, I need to add an anonymous struct to 90% of my handlers that just currently pass nil
.
Is there way to do something like
{{if eq . nil}}
// default meta tag
{{else if eq .MetaValue "some-x"}}
//other
{{end}}
If I try something like my above code, it compiles but doesn't do what I want. Appreciate any suggestions on how to handle it properly without adding a lot of boiler plate.
Thanks!
defined template
. If I have partials defined in each template (say "title") and I want to check the existence of it, there is no way to do that I presume? i.e., the pipeline can only come from the go handler? – Middleaged