feat: title on pages

This commit is contained in:
2026-03-19 18:27:23 +01:00
parent 2b07701762
commit 16e5107185
18 changed files with 251 additions and 36 deletions
+7 -1
View File
@@ -8,6 +8,7 @@ import (
"net/http"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/config"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/templer"
"github.com/a-h/templ"
)
@@ -27,10 +28,15 @@ func (l *Layouts) Render(ctx context.Context, w io.Writer, r *http.Request, comp
withLayout := !r.URL.Query().Has("c")
fmt.Println("layout: ", withLayout)
title := templer.GetTitle(ctx, "Schreifuchs")
slog.Debug("HX-Request", "value", r.Header.Get("HX-Request"))
if r.Header.Get("HX-Request") != "true" {
ctx = templ.WithChildren(ctx, component)
component = Base(l.cfg, "Schreifuchs")
component = Base(l.cfg, title)
} else {
ctx = templ.WithChildren(ctx, component)
component = Head(l.cfg, title)
}
if err := component.Render(ctx, w); err != nil {