learnlytics-go/templ/examples/integration-gofiber/home.templ

20 lines
333 B
Plaintext
Raw Normal View History

2025-03-20 12:35:13 +01:00
package main
import "context"
func NameFromContext(ctx context.Context) string {
if name, ok := ctx.Value("name").(string); ok && name != "" {
return name
}
return "World"
}
templ Home(name string) {
<div>Hello { name }</div>
<div>Hello { NameFromContext(ctx) } (from context)</div>
}
templ NotFound() {
<div>404</div>
}