speed up the home page
This commit is contained in:
parent
c4b14dd513
commit
61b91a84f1
6
honk.go
6
honk.go
|
@ -116,7 +116,6 @@ func homepage(w http.ResponseWriter, r *http.Request) {
|
||||||
sort.Slice(honks, func(i, j int) bool {
|
sort.Slice(honks, func(i, j int) bool {
|
||||||
return honks[i].Date.After(honks[j].Date)
|
return honks[i].Date.After(honks[j].Date)
|
||||||
})
|
})
|
||||||
reverbolate(honks)
|
|
||||||
|
|
||||||
var modtime time.Time
|
var modtime time.Time
|
||||||
if len(honks) > 0 {
|
if len(honks) > 0 {
|
||||||
|
@ -132,13 +131,18 @@ func homepage(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reverbolate(honks)
|
||||||
|
|
||||||
msg := "Things happen."
|
msg := "Things happen."
|
||||||
getconfig("servermsg", &msg)
|
getconfig("servermsg", &msg)
|
||||||
templinfo["Honks"] = honks
|
templinfo["Honks"] = honks
|
||||||
templinfo["ShowRSS"] = true
|
templinfo["ShowRSS"] = true
|
||||||
templinfo["ServerMessage"] = msg
|
templinfo["ServerMessage"] = msg
|
||||||
|
if u == nil {
|
||||||
|
w.Header().Set("Cache-Control", "max-age=60")
|
||||||
|
} else {
|
||||||
w.Header().Set("Cache-Control", "max-age=0")
|
w.Header().Set("Cache-Control", "max-age=0")
|
||||||
|
}
|
||||||
w.Header().Set("Last-Modified", modtime.Format(http.TimeFormat))
|
w.Header().Set("Last-Modified", modtime.Format(http.TimeFormat))
|
||||||
err := readviews.ExecuteTemplate(w, "homepage.html", templinfo)
|
err := readviews.ExecuteTemplate(w, "homepage.html", templinfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue