No, still not there. <{{ printf "%s" $tag | safeHTML }}> also outputs <h2>, and putting the whole tag inside printf, ie. {{ printf "<%s class="...">" $tag | safeHTML }} causes errors. Plus, readability suffers and it’s quite wordy
Out of the options that work, I usually choose the one that’s most readable, even at the cost of some efficiency or code duplication. My current best option, considering these priorities, is:
{{ if .IsHome }}
<h1>...</h1>
{{ else }}
<h2>....</h2>
{{ end }}