From 225759ddb367a5d15f00d22b0f16ea360c617b53 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Fri, 14 Dec 2018 04:52:16 +0000 Subject: [PATCH] vanity import --- cmd/site/main.go | 10 +++++++++- go.mod | 2 +- templates/base.html | 1 + templates/index.html | 4 +++- 4 files changed, 14 insertions(+), 3 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)) diff --git a/go.mod b/go.mod index e6cd435..8b3cb7c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/Xe/site +module christine.website require ( github.com/Xe/gopreload v0.0.0-20170326043426-a00a8beb369c diff --git a/templates/base.html b/templates/base.html index c00bc1e..c42feed 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,6 +3,7 @@ {{ template "title" . }} + diff --git a/templates/index.html b/templates/index.html index 9043e5f..76902be 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,4 +1,6 @@ -{{ define "title" }}Christine Dodrill{{ end }} +{{ define "title" }} +Christine Dodrill +{{ end }} {{ define "content" }}