Template system
The template system lets you build user interfaces using syntax integrated directly into the GOX language.
Templates combine HTML with language constructs to describe interfaces declaratively.
They form the basis of GOX's rendering system and are used to build pages, components, and other rendered output.
Inline HTML
Unlike traditional Go template engines, GOX templates are part of the language itself.
They do not require separate template files or an external rendering engine, so you can write your interface alongside the rest of your code.
For example:
module index
import "github.com/gox-lang/gox"
func GET(ctx *gox.Context) gox.Page {
return <main>
<h1>Hola GOX</h1>
<p>Bienvenido a mi aplicación.</p>
</main>
} The different elements that form a temperate, such as expressions, conditionals, loops and components, are explained in the following chapters.
Language extensions
In addition to standard HTML, GOX provides constructs for expressing presentation logic.
Each of these constructs has its own documentation page.
Integration with Go
As part of the language itself, templates can directly access any member available in the function’s scope.
This lets you combine Go with GOX constructs naturally, without switching languages or relying on an external template engine.