liveBook · Manning

Template action

A template action is a delimited instruction in a template that evaluates data, expressions, control flow, definitions, or function calls.

How 2 Manning books explain it

Learn Go with Pocket-Sized Projects

A template action is a delimited instruction in a template that evaluates data, control flow, definitions, or function calls.

How it is used
Uses delimited actions to generate structured output from data instead of cumbersome fmt.Sprintf or strings.Builder code.
How deep it goes
Explains parsing, execution, dot-based interpolation, field access, iteration, conditionals, and scoped contexts.
Examples
Demonstrates {{.}} in an HTML habits page and executes it with the value 5.
What you can do after
Apply it via Go templates to interpolate values and express conditionals, iteration, field access, and scoped output.

Read how Learn Go with Pocket-Sized Projects explains template action →

Go in Practice, Second Edition

A Go action is a command or data expression enclosed in double curly brackets within a Go template.

How it is used
Uses double-curly-bracket expressions to render, iterate, format, and control values in HTML templates.
How deep it goes
Explains field actions, range iteration, pipelines, custom functions, and context-aware escaping without detailing the complete action language.
Examples
Demonstrates title and content fields, comment iteration, URL escaping, HTML escaping, and custom date formatting.
What you can do after
Build HTML templates that render data, iterate collections, apply pipelines, and call registered Go formatting functions.

Read how Go in Practice, Second Edition explains template action →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.