From d083d5d72e4bf496b8152d14986818a5b63fe301 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Sat, 17 Dec 2022 12:45:21 +0530 Subject: routes: serve static content from /static --- routes/template.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'routes/template.go') diff --git a/routes/template.go b/routes/template.go index 3d1e1cf..dc1ec35 100644 --- a/routes/template.go +++ b/routes/template.go @@ -13,7 +13,7 @@ import ( ) func (d *deps) Write404(w http.ResponseWriter) { - tpath := filepath.Join(d.c.Template.Dir, "*") + tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) w.WriteHeader(404) if err := t.ExecuteTemplate(w, "404", nil); err != nil { @@ -22,7 +22,7 @@ func (d *deps) Write404(w http.ResponseWriter) { } func (d *deps) Write500(w http.ResponseWriter) { - tpath := filepath.Join(d.c.Template.Dir, "*") + tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) w.WriteHeader(500) if err := t.ExecuteTemplate(w, "500", nil); err != nil { @@ -31,7 +31,7 @@ func (d *deps) Write500(w http.ResponseWriter) { } func (d *deps) listFiles(files []git.NiceTree, data map[string]any, w http.ResponseWriter) { - tpath := filepath.Join(d.c.Template.Dir, "*") + tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) data["files"] = files @@ -62,7 +62,7 @@ func countLines(r io.Reader) (int, error) { } func (d *deps) showFile(content string, data map[string]any, w http.ResponseWriter) { - tpath := filepath.Join(d.c.Template.Dir, "*") + tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) lc, err := countLines(strings.NewReader(content)) -- cgit