From 6aa5ce04b2b9742391dab805af9d83778d7e98b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20L=C3=A4rfors?= <1135394+jlarfors@users.noreply.github.com> Date: Sun, 8 Sep 2024 21:21:55 +0300 Subject: [PATCH] add redirect for /insights/* to /blog/* --- server.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server.go b/server.go index 48cdb0a..5ac72f5 100644 --- a/server.go +++ b/server.go @@ -666,6 +666,16 @@ func Run(ctx context.Context, site Site) error { ) return } + // Handle /insights/ which was where we hosted the blog before. + router.Get("/insights/*", func(w http.ResponseWriter, r *http.Request) { + wildcard := chi.URLParam(r, "*") + http.Redirect( + w, + r, + "/blog/"+wildcard, + http.StatusMovedPermanently, + ) + }) w.WriteHeader(http.StatusNotFound) pageInfo := PageInfo{ RequestURI: r.RequestURI,