package component type PageOptions struct { Title string Head func() templ.Component } type PageOptionFunc func(opts *PageOptions) func WithTitle(title string) PageOptionFunc { return func(opts *PageOptions) { if title != "" { opts.Title = title + " | ClearCase" } else { opts.Title = "ClearCase" } } } func WithHead(fn func() templ.Component) PageOptionFunc { return func(opts *PageOptions) { opts.Head = fn } } func NewPageOptions(funcs ...PageOptionFunc) *PageOptions { opts := &PageOptions{ Title: "", Head: nil, } for _, fn := range funcs { fn(opts) } return opts } templ Page(funcs ...PageOptionFunc) { {{ opts := NewPageOptions(funcs...) }}