Better inital

This commit is contained in:
Simon Martens
2026-02-18 16:28:05 +01:00
parent e9f1d32e3a
commit df79656c77
22 changed files with 1850 additions and 30 deletions

33
pages/home.go Normal file
View File

@@ -0,0 +1,33 @@
package pages
import (
"bytes"
"github.com/Theodor-Springmann-Stiftung/lenz-web/app"
)
type HomePage struct{}
func init() {
app.RegisterPage(HomePage{})
}
func (p HomePage) Discover(a *app.App) ([]app.Route, error) {
return []app.Route{
{Path: "/", Kind: "page", ID: "home"},
}, nil
}
func (p HomePage) Model(a *app.App, route app.Route) (map[string]any, error) {
return map[string]any{
"Message": "Template system is working.",
}, nil
}
func (p HomePage) Render(a *app.App, route app.Route, model map[string]any) ([]byte, error) {
var buf bytes.Buffer
if err := a.Templates().ExecuteTemplate(&buf, "home", model); err != nil {
return nil, err
}
return buf.Bytes(), nil
}