From 6b3933282e3aa9803636b2ba580aced5c202eaa9 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Tue, 24 Jan 2023 12:40:32 +0100 Subject: Refactor URL construction a bit BlogHTTPURL and BlogGeminiURL are now used specifically to construct absolute URLs to their respective endpoints. --- src/gmi/tpl.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gmi/tpl.go') diff --git a/src/gmi/tpl.go b/src/gmi/tpl.go index 566ace0..5777024 100644 --- a/src/gmi/tpl.go +++ b/src/gmi/tpl.go @@ -161,6 +161,9 @@ func (a *api) tplHandler() (gemini.Handler, error) { BlogHTTPURL: func(path string) string { return blogURL(a.params.HTTPPublicURL, path, true) }, + BlogGeminiURL: func(path string) string { + return blogURL(a.params.PublicURL, path, true) + }, AssetURL: func(id string) string { path := filepath.Join("assets", id) return blogURL(a.params.PublicURL, path, false) @@ -193,12 +196,9 @@ func (a *api) tplHandler() (gemini.Handler, error) { allTpls := template.New("") - allTpls.Funcs(preprocessFuncs.ToFuncsMap()) + allTpls.Funcs(preprocessFuncs.ToFuncMap()) allTpls.Funcs(template.FuncMap{ - "BlogURLAbs": func(path string) string { - return blogURL(a.params.PublicURL, path, true) - }, "PostURLAbs": func(id string) string { path := filepath.Join("posts", id) + ".gmi" return blogURL(a.params.PublicURL, path, true) -- cgit v1.2.3