Examples
Here you will find applications that have been developed using GoHT. These applications are meant to demonstrate the capabilities of GoHT and to provide examples of how to use GoHT in your own projects.
Feature Examples
These smaller examples focus on individual GoHT features. The examples use placeholder Product and User domain types so they can stay focused on template syntax rather than application setup.
Slim Template
Slim templates use tag names directly. This example shows tags, attributes, interpolation, and @render composition:
EGO Template
EGO templates keep standard HTML and use Go-style tags for dynamic output and GoHT commands:
Named Slots
Named slots let callers fill specific regions. A slot can also provide default content when no matching slot is supplied:
Fill the badges and actions slots from Go with the generated WithBadges and WithActions methods:
Since ProductLayout provides default content for actions, that footer link renders unless the caller calls WithActions(...).
HTTP Handlers
Generated template functions return a typed template value that implements goht.Template. In an HTTP handler, call Render with the request context and response writer: