aboutsummaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2020-11-15 11:33:24 -0500
committerMitch Riedstra <mitch@riedstra.us>2020-11-15 11:33:50 -0500
commit6c9e0c274d81b9b2256acf35a55fca0d3213b0d6 (patch)
tree25ab0553725a391875d99f883fa3a60f5489b20a /http
parentace8e9968c5b215f343f2a1d2084cd05354dd28e (diff)
downloadgo-website-6c9e0c274d81b9b2256acf35a55fca0d3213b0d6.tar.gz
go-website-6c9e0c274d81b9b2256acf35a55fca0d3213b0d6.tar.xz
Add a few additional parmaeters. Clean up the import path.
Diffstat (limited to 'http')
-rw-r--r--http/main.go9
1 files changed, 7 insertions, 2 deletions
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)
}
}