load home template from the cache properly
This commit is contained in:
parent
3dbd5a86e2
commit
1e8c664807
|
@ -45,7 +45,19 @@ func Initialise(a *config.AppConfig) {
|
||||||
// HomeHandler handles /, generating data from Handlers
|
// HomeHandler handles /, generating data from Handlers
|
||||||
func HomeHandler(w http.ResponseWriter, r *http.Request) {
|
func HomeHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
app.Logger.Info("Got request for homepage")
|
app.Logger.Info("Got request for homepage")
|
||||||
d := td.MakeBasicTemplateData(time.Now())
|
|
||||||
|
page := "home.page.tmpl"
|
||||||
|
d := models.TemplateData{}
|
||||||
|
|
||||||
|
t, err := render.GetTemplateFromCache(page)
|
||||||
|
if err != nil {
|
||||||
|
app.Logger.Error(fmt.Sprintf("couldn't get %s from cache", page), "err", err)
|
||||||
|
} else {
|
||||||
|
d.StringMap = map[string]string{
|
||||||
|
"GeneratedAt": t.GeneratedAt.Format(time.UnixDate),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var pages []models.Link = []models.Link{}
|
var pages []models.Link = []models.Link{}
|
||||||
|
|
||||||
for _, handler := range Handlers {
|
for _, handler := range Handlers {
|
||||||
|
|
Loading…
Reference in a new issue