Control Structures
Use native Go template logic like if, range, and with.
Control Structures
Go templates support simple control logic directly:
{{ if .ShowMessage }}
<p>{{ .Message }}</p>
{{ end }}
{{ range .Items }}
<li>{{ . }}</li>
{{ end }}
Use range
to iterate over slices and with
to change the context scope. Avoid complex logic - do it in Go.