Go's standard html/template works well. It is in the standard library, is well documented, and provides contextual escaping. We used it before switching to Templ . Here's why.
The Problem With html/template
As the codebase grew, we hit recurring issues:
Template mistakes surface at runtime. Write {{.Titl}} instead of {{.Title}} and template execution returns an error. It is not normally a panic, but it is still later feedback than a compiler error.
Weaker editor support. Support varies by editor and plugin, but field completion, navigation, and refactoring are less reliable across the boundary between Go and template text.
Runtime data contracts. The template expects particular fields and methods, but the Go compiler does not type-check those references. Rename a field and tests—or a request that executes the template—must catch it.
What Templ Gives Us
Templ files use their own Go-like syntax.…