From 024f51488614919240a71cae1cae1c8fe6df1229 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Mon, 23 Jan 2023 21:44:10 +0100 Subject: Add BlogHTTPURL preprocess function --- src/post/preprocess.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/post/preprocess.go') diff --git a/src/post/preprocess.go b/src/post/preprocess.go index 424c7b8..3ec54ca 100644 --- a/src/post/preprocess.go +++ b/src/post/preprocess.go @@ -17,6 +17,12 @@ type PreprocessFunctions struct { // The given path should not have a leading slash. BlogURL func(path string) string + // BlogURL returns the given string, rooted to the base URL of the blog's + // HTTP server (which may or may not include path components itself). + // + // The given path should not have a leading slash. + BlogHTTPURL func(path string) string + // AssetURL returns the URL of the asset with the given ID. AssetURL func(id string) string @@ -39,11 +45,12 @@ type PreprocessFunctions struct { func (funcs PreprocessFunctions) ToFuncsMap() template.FuncMap { return template.FuncMap{ - "BlogURL": funcs.BlogURL, - "AssetURL": funcs.AssetURL, - "PostURL": funcs.PostURL, - "StaticURL": funcs.StaticURL, - "Image": funcs.Image, + "BlogURL": funcs.BlogURL, + "BlogHTTPURL": funcs.BlogHTTPURL, + "AssetURL": funcs.AssetURL, + "PostURL": funcs.PostURL, + "StaticURL": funcs.StaticURL, + "Image": funcs.Image, } } -- cgit v1.2.3