From cc2f31d6d5f47472e7162c9aec605587f0abaad8 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Thu, 2 Oct 2025 18:49:06 +0200 Subject: feat(backend): config name and description --- backend/data.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'backend/data.go') diff --git a/backend/data.go b/backend/data.go index 3bc93d1..fd05fa9 100644 --- a/backend/data.go +++ b/backend/data.go @@ -14,15 +14,25 @@ type data struct { URL string Image string Description string + Name string } func (d *data) handleGeneric(w http.ResponseWriter, r *http.Request, name string) { + cfg := r.Context().Value("config").(*Config) if d.Domain == "" { - cfg := r.Context().Value("config").(*Config) d.Domain = cfg.Domain } + if d.Name == "" { + d.Name = cfg.Name + } + if d.Description == "" { + d.Description = cfg.Description + } if d.URL == "" { - d.URL = strings.TrimPrefix(r.URL.Path, "/") + if !strings.HasPrefix(r.URL.Path, "/") { + r.URL.Path = "/" + r.URL.Path + } + d.URL = r.URL.Path } t, err := template.New("").Funcs(template.FuncMap{ "static": func(path string) string { @@ -42,7 +52,7 @@ func (d *data) handleGeneric(w http.ResponseWriter, r *http.Request, name string } func (d *data) Title() string { - title := "anhgelus" + title := d.Name if d.Article { title += " - log entry" } -- cgit v1.2.3