Debian Codegraph @

docs/content/en/_common/functions/go-html-template-package.md

raw
1 ---
2 _comment: Do not remove front matter.
3 ---
4
5 Hugo uses Go's [`text/template`][] and [`html/template`][] packages.
6
7 The `text/template` package implements data-driven templates for generating textual output, while the `html/template` package implements data-driven templates for generating HTML output safe against code injection.
8
9 By default, Hugo uses the `html/template` package when rendering HTML files.
10
11 To generate HTML output that is safe against code injection, the `html/template` package escapes strings in certain contexts.
12
13 [`html/template`]: https://pkg.go.dev/html/template
14 [`text/template`]: https://pkg.go.dev/text/template