文字列が入っている時だけ表示する
{{if .ReturnUrl}}
<a class="ui button" href="{{.ReturnUrl}}">戻る</a>
{{else}}
戻れません
{{end}}
コメント
{{/* ここにかく */}}
エスケープさせない
コード
body := "<b>test</b>"
err := templ.Execute(w, map[string]interface{}{
"Body": template.HTML(body),
})
テンプレートは他のと変わらない
{{.Body}}
テンプレートを読み込む
templ, err := template.ParseFiles("views/index.html")