package templates import ( "context" "go.alanpearce.eu/homestead/internal/config" "io" "net/url" ) type PageSettings struct { Title string Path string TitleAttrs templ.Attributes BodyAttrs templ.Attributes } func extendClasses(cs string, attrs templ.Attributes) string { if extras, exists := attrs["class"]; exists { return templ.Classes(cs, extras).String() } else { return cs } } templ menuItem(item config.MenuItem) { { item.Name } } templ Layout(site *config.Config, page PageSettings) { { page.Title } @style(CSS)

{ site.Title }

{ children... }
if site.InjectLiveReload { } } func mkURL(original config.URL, path string, title string) string { ou := *original.URL u := config.URL{ URL: &ou, } q := url.Values{} q.Add("p", path) q.Add("t", title) u.RawQuery = q.Encode() return u.String() } func style(css string) templ.Component { return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) { _, err = io.WriteString(w, "") return }) }