summaryrefslogtreecommitdiff
path: root/srv/src/http/tpl.go
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-08-18 23:07:09 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-08-18 23:07:09 -0600
commitc3135306b32e3ee18c3c412fbb2ea81b455201d5 (patch)
treef7dd21fc9e0bab9b06a713a8218e52be777f1b15 /srv/src/http/tpl.go
parentdfa9bcb9e23b10bb28973d1d27f05e04e8638320 (diff)
drafts functionality added, needs a publish button still
Diffstat (limited to 'srv/src/http/tpl.go')
-rw-r--r--srv/src/http/tpl.go16
1 files changed, 14 insertions, 2 deletions
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")