Syntax

Learn about the syntax of GoHT templates.

GoHT supports three template syntaxes in .goht files:

  • Haml templates start with @haml and use Haml-style tags such as %div.
  • Slim templates start with @slim and use Slim-style tags such as div.
  • EGO templates start with @ego and use HTML with Go tags such as <%= value %>.

The Haml and Slim pages in this section describe indentation-based syntax, attributes, filters, comments, interpolation, and whitespace handling. EGO uses normal HTML outside its <% ... %> tags, so most Haml/Slim-specific syntax pages do not apply to EGO.

Use @render, @children, @slot, and @attributes for GoHT-specific composition and dynamic behavior.

The current syntax reference documents supported behavior for new templates. Use @haml, @slim, or @ego in new code; the older @goht directive remains only as a deprecated Haml alias for existing templates.