Legacy /category/ URI
This commit is contained in:
parent
946a05c505
commit
1430c54f0e
|
@ -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"]
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user