feat: add umami
/ publish (push) Failing after 2m14s

This commit is contained in:
2026-03-08 16:11:57 +01:00
parent 01b24f830f
commit 1310b7b243
7 changed files with 40 additions and 9 deletions
+3 -1
View File
@@ -3,8 +3,9 @@ package layouts
import "git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/components/translate"
import "strings"
import "git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/templer"
import "git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/config"
templ Base(title string) {
templ Base(cfg config.Cfg, title string) {
<!DOCTYPE html>
<html lang={ translate.Language(ctx) }>
<head>
@@ -15,6 +16,7 @@ templ Base(title string) {
<link fetchpriority="high" href="/css/output.css" rel="stylesheet"/>
<script fetchpriority="low" src="/js/htmx.min.js"></script>
<script src="/js/preload.min.js"></script>
<script src={ cfg.Tracking.ScriptSrc } data-website-id={ cfg.Tracking.WebsiteID }></script>
</head>
<body class="bg-black dark" hx-boost="true" hx-target="main" hx-ext="preload">
<header
+13 -2
View File
@@ -7,19 +7,30 @@ import (
"log/slog"
"net/http"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/config"
"github.com/a-h/templ"
)
type Layouts struct {
cfg config.Cfg
}
func New(cfg config.Cfg) *Layouts {
return &Layouts{
cfg: cfg,
}
}
// Render renders a page. If the query paramenter "c" is set
// the component gets rendered without the layout
func Render(ctx context.Context, w io.Writer, r *http.Request, component templ.Component) {
func (l *Layouts) Render(ctx context.Context, w io.Writer, r *http.Request, component templ.Component) {
withLayout := !r.URL.Query().Has("c")
fmt.Println("layout: ", withLayout)
slog.Debug("HX-Request", "value", r.Header.Get("HX-Request"))
if r.Header.Get("HX-Request") != "true" {
ctx = templ.WithChildren(ctx, component)
component = Base("Schreifuchs")
component = Base(l.cfg, "Schreifuchs")
}
if err := component.Render(ctx, w); err != nil {