diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..72bb6a1 Binary files /dev/null and b/favicon.ico differ diff --git a/route_handlers.go b/route_handlers.go index ee73ca8..0f17eae 100644 --- a/route_handlers.go +++ b/route_handlers.go @@ -15,6 +15,7 @@ import ( "github.com/dballard/transmet/news" "bytes" txtTemplate "text/template" + "path" ) func GetFlashes(session *sessions.Session) map[string]interface{} { @@ -250,10 +251,18 @@ func addedHandler(w http.ResponseWriter, r *http.Request, user *user.User) { ShowTemplate("added", w, map[string]interface{}{"user": user, "flashes": flashes}) } + + +func ServeFileHandler(res http.ResponseWriter, req *http.Request) { + fname := path.Base(req.URL.Path) + http.ServeFile(res, req, "./"+fname) + } + func init_route_handlers() { http.Handle("/js/", http.StripPrefix("/js/", http.FileServer(http.Dir("js/")))) http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("css/")))) http.Handle("/fonts/", http.StripPrefix("/fonts", http.FileServer(http.Dir("fonts/")))) + http.HandleFunc("/favicon.ico", ServeFileHandler) r := mux.NewRouter() diff --git a/templates/layout.html b/templates/layout.html index a4a5488..e0bbe25 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -12,6 +12,8 @@ + +