From 6c9e0c274d81b9b2256acf35a55fca0d3213b0d6 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Sun, 15 Nov 2020 11:33:24 -0500 Subject: Add a few additional parmaeters. Clean up the import path. --- http/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'http') diff --git a/http/main.go b/http/main.go index 875f4b9..d7c6399 100644 --- a/http/main.go +++ b/http/main.go @@ -10,8 +10,8 @@ import ( "path/filepath" "strings" - "git.riedstra.dev/mitch/go-website/local" - "git.riedstra.dev/mitch/go-website/page" + "riedstra.dev/mitch/go-website/local" + "riedstra.dev/mitch/go-website/page" "github.com/gorilla/mux" ) @@ -23,6 +23,10 @@ var NewPage func(string) page.Page = func(u string) page.Page { return &local.Page{Path: u} } +// ReindexRedirectTo is the path that we'll redirect to when a call to rebuild +// index is called +var ReindexRedirectTo = "/fullIndex" + func GetHandler() http.Handler { if NewPage == nil { fmt.Fprintln(os.Stderr, "Warning, global NewPage method is not defined!") @@ -70,6 +74,7 @@ func RebuildIndexHandler(w http.ResponseWriter, r *http.Request) { if r.Method != "POST" { p := NewPage("index") _ = p.RebuildIndex() + http.Redirect(w, r, ReindexRedirectTo, 302) } } -- cgit v1.2.3