aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorknotteye <knotteye@airmail.cc>2021-07-02 14:20:16 -0500
committerknotteye <knotteye@airmail.cc>2021-07-02 14:20:16 -0500
commitfaae38726dd804e3246514d88f93794c23a0cdb2 (patch)
tree4671606919340098b81c398e8478ba616a0432b1 /main.go
parentad5f4e9ff7e7ab0abab4a964cbf1626d0cdc3365 (diff)
show only the last 3 news items on index, link to a page with all news items
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 6 insertions, 0 deletions
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]
}