From 1cfdac5e8c2ac802275cb29ae9149c55547f38fb Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 22 Jan 2023 12:09:50 +0100 Subject: Allow url construction to work if blog is under a sub-path --- src/gmi/tpl.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gmi/tpl.go') diff --git a/src/gmi/tpl.go b/src/gmi/tpl.go index e448afd..c648abd 100644 --- a/src/gmi/tpl.go +++ b/src/gmi/tpl.go @@ -37,6 +37,7 @@ type rendererGetPostSeriesNextPreviousRes struct { type renderer struct { url *url.URL postStore post.Store + gmiPublicURL *url.URL httpPublicURL *url.URL } @@ -92,7 +93,7 @@ func (r renderer) PostBody(p post.StoredPost) (string, error) { preprocessFuncs := post.PreprocessFunctions{ BlogURL: func(path string) string { - return filepath.Join("/", path) + return filepath.Join("/", r.gmiPublicURL.Path, path) }, AssetURL: func(id string) string { return filepath.Join("/assets", id) @@ -220,6 +221,7 @@ func (a *api) tplHandler() (gemini.Handler, error) { err := tpl.Execute(buf, renderer{ url: r.URL, postStore: a.params.PostStore, + gmiPublicURL: a.params.PublicURL, httpPublicURL: a.params.HTTPPublicURL, }) -- cgit v1.2.3