From faae38726dd804e3246514d88f93794c23a0cdb2 Mon Sep 17 00:00:00 2001 From: knotteye Date: Fri, 2 Jul 2021 14:20:16 -0500 Subject: show only the last 3 news items on index, link to a page with all news items --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 69e8902..3eb47c0 100644 --- a/main.go +++ b/main.go @@ -293,6 +293,12 @@ func main() { http.HandleFunc("/news/", func(w http.ResponseWriter, r *http.Request){ timestamp := r.URL.Path[6:] + + if(len(timestamp) < 2) { + AllNewsGet(w, r, db) + return + } + if timestamp[len(timestamp)-1:] == "/" { timestamp = timestamp[:len(timestamp)-1] } -- cgit v1.2.3