From 388456b88100aeeb6ca2c0806e1bffba381e944a Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Thu, 11 Dec 2025 03:29:40 -0500 Subject: Don't show next if there is no next --- cmd/web/handlers/blog.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'cmd/web/handlers/blog.go') diff --git a/cmd/web/handlers/blog.go b/cmd/web/handlers/blog.go index e9512c0..4c81669 100644 --- a/cmd/web/handlers/blog.go +++ b/cmd/web/handlers/blog.go @@ -19,11 +19,12 @@ type blogContext struct { err *log.Logger db *sql.DB - Post models.Post - Rows []models.Post - Name string - IsAuth bool - Offset int + Post models.Post + Rows []models.Post + Name string + IsAuth bool + PagePopulated bool + Offset int } func (ctx *blogContext) viewPost(w http.ResponseWriter, r *http.Request) { @@ -186,6 +187,7 @@ func (ctx *blogContext) post(w http.ResponseWriter, r *http.Request) { func (ctx *blogContext) index(w http.ResponseWriter, r *http.Request) { ctx.Rows = []models.Post{} ctx.IsAuth = false + ctx.PagePopulated = false if r.URL.Path != "/" { http.NotFound(w, r) @@ -221,6 +223,7 @@ func (ctx *blogContext) index(w http.ResponseWriter, r *http.Request) { p.FormattedTime = p.Time.Format(time.ANSIC) ctx.Rows = append(ctx.Rows, p) + ctx.PagePopulated = true } files := []string{ -- cgit v1.2.3