aboutsummaryrefslogtreecommitdiff
path: root/backend/data.go
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2025-10-03 22:22:40 +0200
committerWilliam Hergès <william@herges.fr>2025-10-03 22:22:40 +0200
commit40b1f53362105a495c6a486f3488e83d79eb582a (patch)
treeb84609a49ad55881d0e54f72a474d3bbb1db31ae /backend/data.go
parentce6a2da035dc045510157a0eeefaebf56f0e8958 (diff)
feat(markdown): eval option to setup custom image source func
Diffstat (limited to 'backend/data.go')
-rw-r--r--backend/data.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/backend/data.go b/backend/data.go
index 3635a7e..241f47a 100644
--- a/backend/data.go
+++ b/backend/data.go
@@ -68,12 +68,7 @@ func (d *data) handleGeneric(w http.ResponseWriter, r *http.Request, name string
d.URL = r.URL.Path
}
t, err := template.New("").Funcs(template.FuncMap{
- "static": func(path string) string {
- if regexIsHttp.MatchString(path) {
- return path
- }
- return fmt.Sprintf("/static/%s", path)
- },
+ "static": getStatic,
"fullStatic": func(path string) string {
if regexIsHttp.MatchString(path) {
return path
@@ -123,3 +118,10 @@ func (d *data) Title() string {
func (d *data) PubDate() string {
return ""
}
+
+func getStatic(path string) string {
+ if regexIsHttp.MatchString(path) {
+ return path
+ }
+ return fmt.Sprintf("/static/%s", path)
+}