This is a base page template. All the other template pages implement this interface. {% import "context" %} {% import "strconv" %} {% import "time" %} {% code var Slug = "" %} {% interface Page { Title(ctx context.Context) Content(ctx context.Context) Script(ctx context.Context) Navbar(ctx context.Context) } %} {% code func FromUInttoString(u *uint) string { if u != nil { return strconv.FormatUint(uint64(*u), 10) } return "" } %} {% code func TimeFormat(t time.Time) string { return t.Format("02.01.2006") } %} {% code func Ignore[T any](v T, _ error) T { return v } %} {% code func IsAuthenticationDisabled(ctx context.Context) bool { t, ok := ctx.Value("disableAuthentication").(bool) return ok && t } %} {% code func IsLoggedIn(ctx context.Context) bool { t, ok := ctx.Value("logged").(bool) return ok && t } %} Page prints a page implementing Page interface. {% func PageTemplate(p Page, ctx context.Context) %} {%= p.Title(ctx) %} {%= p.Navbar(ctx) %}
{%= p.Content(ctx) %}
{%= p.Script(ctx) %} {% endfunc %}