summaryrefslogtreecommitdiff
path: root/src/post
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2023-01-23 21:44:10 +0100
committerBrian Picciano <mediocregopher@gmail.com>2023-01-23 21:44:10 +0100
commit024f51488614919240a71cae1cae1c8fe6df1229 (patch)
treef423fd10b1bdfcfc9fe700c4ae31254f2380a557 /src/post
parent26dbc6691dbe038cbbbeb11195678d77693b335d (diff)
Add BlogHTTPURL preprocess function
Diffstat (limited to 'src/post')
-rw-r--r--src/post/preprocess.go17
1 files changed, 12 insertions, 5 deletions
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,
}
}