some cleanup in render.go

This commit is contained in:
Lilian Jónsdóttir 2024-01-23 16:17:44 -08:00
parent 8a2319033e
commit d9434f49ab

View file

@ -107,14 +107,12 @@ func RenderTemplate(w http.ResponseWriter, filename string) {
if err == nil { if err == nil {
app.Logger.Debug(fmt.Sprintf("Loaded data for template %s.", filename), "data", data) app.Logger.Debug(fmt.Sprintf("Loaded data for template %s.", filename), "data", data)
if _, ok := data.StringMap["GeneratedAt"]; !ok { if _, ok := data.StringMap["GeneratedAt"]; !ok {
data.StringMap["GeneratedAt"] = app.TemplateCache.Cache[filename].GeneratedAt.Format(time.UnixDate) data.StringMap["GeneratedAt"] = template.GeneratedAt.Format(time.UnixDate)
} }
} else { } else {
app.Logger.Info(fmt.Sprintf("Loading template data for %s failed, using default template data.", filename), "err", err) app.Logger.Info(fmt.Sprintf("Loading template data for %s failed, using default template data.", filename), "err", err)
data = models.MakeBasicTemplateData(template.GeneratedAt) data = models.MakeBasicTemplateData(template.GeneratedAt)
} }
l := data.LinkMap["Personal"]
app.Logger.Debugf("%[1]v is %[1]T", l)
// Execute templates in a new buffer // Execute templates in a new buffer
buf := new(bytes.Buffer) buf := new(bytes.Buffer)