From c3135306b32e3ee18c3c412fbb2ea81b455201d5 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 18 Aug 2022 23:07:09 -0600 Subject: drafts functionality added, needs a publish button still --- srv/src/http/tpl.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'srv/src/http/tpl.go') diff --git a/srv/src/http/tpl.go b/srv/src/http/tpl.go index 2edd7ac..3e1a2ba 100644 --- a/srv/src/http/tpl.go +++ b/srv/src/http/tpl.go @@ -57,6 +57,15 @@ func (a *api) assetsURL(abs bool) string { return a.blogURL("assets", abs) } +func (a *api) draftURL(id string, abs bool) string { + path := filepath.Join("drafts", id) + return a.blogURL(path, abs) +} + +func (a *api) draftsURL(abs bool) string { + return a.blogURL("drafts", abs) +} + func (a *api) tplFuncs() template.FuncMap { return template.FuncMap{ "BlogURL": func(path string) string { @@ -71,12 +80,15 @@ func (a *api) tplFuncs() template.FuncMap { b, err := staticFS.ReadFile(path) return template.CSS(b), err }, + "PostURL": func(id string) string { + return a.postURL(id, false) + }, "AssetURL": func(id string) string { path := filepath.Join("assets", id) return a.blogURL(path, false) }, - "PostURL": func(id string) string { - return a.postURL(id, false) + "DraftURL": func(id string) string { + return a.draftURL(id, false) }, "DateTimeFormat": func(t time.Time) string { return t.Format("2006-01-02") -- cgit v1.2.3