all repos — honk @ 7c1a4dc7fd6c3b89d7696c7b44eb5dd7499d4581

my fork of honk

speed up the home page
Ted Unangst tedu@tedunangst.com
Tue, 16 Apr 2019 22:26:17 -0400
commit

7c1a4dc7fd6c3b89d7696c7b44eb5dd7499d4581

parent

4a0a0768c71c2bdcee020fd35f47142071c5d410

1 files changed, 6 insertions(+), 2 deletions(-)

jump to
M honk.gohonk.go

@@ -116,7 +116,6 @@ }

sort.Slice(honks, func(i, j int) bool { return honks[i].Date.After(honks[j].Date) }) - reverbolate(honks) var modtime time.Time if len(honks) > 0 {

@@ -132,13 +131,18 @@ w.WriteHeader(http.StatusNotModified)

return } } + reverbolate(honks) msg := "Things happen." getconfig("servermsg", &msg) templinfo["Honks"] = honks templinfo["ShowRSS"] = true templinfo["ServerMessage"] = msg - w.Header().Set("Cache-Control", "max-age=0") + if u == nil { + w.Header().Set("Cache-Control", "max-age=60") + } else { + w.Header().Set("Cache-Control", "max-age=0") + } w.Header().Set("Last-Modified", modtime.Format(http.TimeFormat)) err := readviews.ExecuteTemplate(w, "homepage.html", templinfo) if err != nil {