diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2023-01-22 12:09:50 +0100 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2023-01-22 12:09:50 +0100 |
commit | 1cfdac5e8c2ac802275cb29ae9149c55547f38fb (patch) | |
tree | 005d493ab0d235c9b7f2c488343fb10f9642be50 /src/gmi | |
parent | f536b16e170a5efb5b3bdd720e48100d5d0f83ba (diff) |
Allow url construction to work if blog is under a sub-path
Diffstat (limited to 'src/gmi')
-rw-r--r-- | src/gmi/tpl.go | 4 |
1 files changed, 3 insertions, 1 deletions
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, }) |