package main import "fmt" // 1. Shared Base Layout Component templ PageLayout(title string) { { title }
{ children... } } // 2. Page 1: Home templ HomePage() { @PageLayout("Home") {

Home

Go server running with Templ templates and Air hot-reloading.

} } // 3. Page 2: About templ AboutPage() { @PageLayout("About") {

About

Single-binary web app using Go's standard library net/http.

} } // Data struct for dynamic rendering type Item struct { Name string Active bool } // 4. Page 3: Dynamic Data (Conditionals + Loops) templ ItemsPage(items []Item) { @PageLayout("Items") {

Items

if len(items) == 0 {

No items in database.

} else { }

{ fmt.Sprintf("Total items processed: %d", len(items)) }

}