diff --git a/core/admin.go b/core/admin.go index 54e7e3c..0e9dfa4 100644 --- a/core/admin.go +++ b/core/admin.go @@ -20,11 +20,11 @@ import ( // AdminRoutes attaches the admin routes to the app. func (b *Blog) AdminRoutes(r *mux.Router) { - adminRouter := mux.NewRouter().PathPrefix("/admin").Subrouter().StrictSlash(false) - r.HandleFunc("/admin", b.AdminHandler) // so as to not be "/admin/" + adminRouter := mux.NewRouter().PathPrefix("/admin").Subrouter().StrictSlash(true) + adminRouter.HandleFunc("/", b.AdminHandler) adminRouter.HandleFunc("/settings", b.SettingsHandler) adminRouter.HandleFunc("/editor", b.EditorHandler) - adminRouter.PathPrefix("/").HandlerFunc(b.PageHandler) + // r.HandleFunc("/admin", b.AdminHandler) r.PathPrefix("/admin").Handler(negroni.New( negroni.HandlerFunc(b.LoginRequired), negroni.Wrap(adminRouter), diff --git a/core/pages.go b/core/pages.go index 30fb261..6712a57 100644 --- a/core/pages.go +++ b/core/pages.go @@ -58,8 +58,9 @@ func (b *Blog) PageHandler(w http.ResponseWriter, r *http.Request) { title, _ := TitleFromMarkdown(body) b.RenderTemplate(w, r, ".markdown", NewVars(map[interface{}]interface{}{ - "Title": title, - "HTML": template.HTML(html), + "Title": title, + "HTML": template.HTML(html), + "MarkdownFile": filepath.URI, })) return } diff --git a/root/.layout.gohtml b/root/.layout.gohtml index 3a77f0f..3a68721 100644 --- a/root/.layout.gohtml +++ b/root/.layout.gohtml @@ -81,7 +81,7 @@ {{ if and .CurrentUser.Admin .Editable }}
- Admin: [edit this page] + Admin: [edit this page]
{{ end }} @@ -197,7 +197,6 @@ - {{ template "scripts" or "" }}