From 1430c54f0e50c65bac1ac0c11d6bdfc6ac5e44ae Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Tue, 2 Jan 2018 11:16:11 -0800 Subject: [PATCH] Legacy /category/ URI --- core/blog.go | 9 +++++++++ core/responses.go | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/blog.go b/core/blog.go index 98f6141..16b291b 100644 --- a/core/blog.go +++ b/core/blog.go @@ -42,6 +42,15 @@ func (b *Blog) BlogRoutes(r *mux.Router) { r.HandleFunc("/archive", b.BlogArchive) r.HandleFunc("/tagged", b.Tagged) r.HandleFunc("/tagged/{tag}", b.Tagged) + r.HandleFunc("/blog/category/{tag}", func(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + tag, ok := params["tag"] + if !ok { + b.NotFound(w, r, "Not Found") + return + } + b.Redirect(w, "/tagged/"+tag) + }) r.HandleFunc("/blog/entry/{fragment}", func(w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) fragment, ok := params["fragment"] diff --git a/core/responses.go b/core/responses.go index c654c12..92e0ebb 100644 --- a/core/responses.go +++ b/core/responses.go @@ -26,7 +26,6 @@ func (b *Blog) FlashAndReload(w http.ResponseWriter, r *http.Request, message st // Redirect sends an HTTP redirect response. func (b *Blog) Redirect(w http.ResponseWriter, location string) { - log.Error("Redirect: %s", location) w.Header().Set("Location", location) w.WriteHeader(http.StatusFound) }