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 "" }} diff --git a/root/about.md b/root/about.md index 8b01f9f..4f2b528 100644 --- a/root/about.md +++ b/root/about.md @@ -1,10 +1,10 @@ -# About Blog - -This is a simple web blog and content management system written in Go. - -## Features - -* Web blog - * Draft, Private Posts -* Page editor - * You can edit any page from the front-end. \ No newline at end of file +# About Blog + +This is a simple web blog and content management system written in Go. + +## Features + +* Web blog + * Draft, Private Posts +* Page editor + * You can edit any page from the front-end. diff --git a/root/admin/editor.gohtml b/root/admin/editor.gohtml index 98918bb..fd218e5 100644 --- a/root/admin/editor.gohtml +++ b/root/admin/editor.gohtml @@ -9,6 +9,25 @@

{{ end }} + +
@@ -31,6 +50,18 @@ +
+
{{ .Data.Body }}
+
+ +
+ Syntax: + HTML + Markdown + JS + CSS + None +
@@ -137,4 +160,38 @@ {{ end }}
+ + + {{ end }}