package builder
import (
"net/url"
"website/internal/config"
)
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 page(site config.Config, page PageSettings) {
{ page.Title }
@style(css)
Skip to main content
{ children... }
@counter(page.Path, page.Title)
if site.InjectLiveReload {
}
}
func mkURL(path string, title string) string {
u, err := url.Parse("https://alanpearce-eu.goatcounter.com/count")
if err != nil {
panic(err)
}
q := u.Query()
q.Add("p", path)
q.Add("t", title)
u.RawQuery = q.Encode()
return u.String()
}
templ counter(path string, title string) {
}
func style(css string) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
_, err = io.WriteString(w, "")
return
})
}