diff options
| author | William Hergès <william@herges.fr> | 2025-10-03 22:22:40 +0200 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-10-03 22:22:40 +0200 |
| commit | 40b1f53362105a495c6a486f3488e83d79eb582a (patch) | |
| tree | b84609a49ad55881d0e54f72a474d3bbb1db31ae /backend/data.go | |
| parent | ce6a2da035dc045510157a0eeefaebf56f0e8958 (diff) | |
feat(markdown): eval option to setup custom image source func
Diffstat (limited to 'backend/data.go')
| -rw-r--r-- | backend/data.go | 14 |
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) +} |
