diff options
| author | Christine Dodrill <me@christine.website> | 2018-12-14 04:52:16 +0000 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2018-12-14 04:54:19 +0000 |
| commit | 225759ddb367a5d15f00d22b0f16ea360c617b53 (patch) | |
| tree | 172d92a2aeb756a9b2d5d06585298a8deba7ab62 /cmd | |
| parent | 58b2870883f45c335e3673cbfe5a9fd96cf50865 (diff) | |
| download | xesite-225759ddb367a5d15f00d22b0f16ea360c617b53.tar.xz xesite-225759ddb367a5d15f00d22b0f16ea360c617b53.zip | |
vanity import
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/site/main.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/site/main.go b/cmd/site/main.go index fa4b9b8..deb9543 100644 --- a/cmd/site/main.go +++ b/cmd/site/main.go @@ -161,7 +161,15 @@ func Build() (*Site, error) { } // Add HTTP routes here - s.mux.Handle("/", s.renderTemplatePage("index.html", nil)) + s.mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/" { + w.WriteHeader(http.StatusNotFound) + s.renderTemplatePage("error.html", "can't find " + r.URL.Path).ServeHTTP(w,r) + return + } + + s.renderTemplatePage("index.html", nil).ServeHTTP(w, r) + }) s.mux.Handle("/resume", s.renderTemplatePage("resume.html", s.Resume)) s.mux.Handle("/blog", s.renderTemplatePage("blogindex.html", s.Posts)) s.mux.Handle("/contact", s.renderTemplatePage("contact.html", nil)) |
