aboutsummaryrefslogtreecommitdiff
path: root/backend/data.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-10-02 18:49:06 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2025-10-02 18:49:06 +0200
commitcc2f31d6d5f47472e7162c9aec605587f0abaad8 (patch)
tree76c6bdfc23a973c3244adc856ae78f6b33a61f56 /backend/data.go
parent49766901293631aeabfc96e8d80aba305f420630 (diff)
feat(backend): config name and description
Diffstat (limited to 'backend/data.go')
-rw-r--r--backend/data.go16
1 files changed, 13 insertions, 3 deletions
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"
}