aboutsummaryrefslogtreecommitdiff
path: root/backend/data.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/data.go')
-rw-r--r--backend/data.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/backend/data.go b/backend/data.go
index 794b763..809e6e6 100644
--- a/backend/data.go
+++ b/backend/data.go
@@ -36,6 +36,7 @@ type data struct {
Links []Link
Logo *Logo
Quote string
+ Language string
}
func (d *data) SetData(data *data) {
@@ -74,6 +75,9 @@ func (d *data) merge(cfg *Config, r *http.Request) {
}
d.URL = r.URL.Path
}
+ if d.Language == "" {
+ d.Language = cfg.Language
+ }
}
func (d *data) handleGeneric(w http.ResponseWriter, r *http.Request, name string, custom dataUsable) {
@@ -117,7 +121,15 @@ func (d *data) handleGeneric(w http.ResponseWriter, r *http.Request, name string
func (d *data) handleRSS(w http.ResponseWriter, r *http.Request, custom dataUsable) {
cfg := r.Context().Value(configKey).(*Config)
d.merge(cfg, r)
- t, err := txt.New("").Funcs(txt.FuncMap{"first": templateFirst}).ParseFS(templates, "templates/rss.xml")
+ t, err := txt.New("").Funcs(txt.FuncMap{
+ "first": templateFirst,
+ "uri": func(s string) string {
+ if s == "" {
+ return ""
+ }
+ return s + "/"
+ },
+ }).ParseFS(templates, "templates/rss.xml")
if err != nil {
panic(err)
}