aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/port/main.go20
1 files changed, 6 insertions, 14 deletions
diff --git a/internal/port/main.go b/internal/port/main.go
index fe85ba4..b233012 100644
--- a/internal/port/main.go
+++ b/internal/port/main.go
@@ -250,25 +250,17 @@ func ListenAndServe(bind, startpagefile string, robotsfile string, robotsdebug b
250 250
251 // 251 //
252 252
253 var templates *template.Template 253 tplBox := packr.New("templates", "./internal/port/tpl")
254 254
255 var allFiles []string 255 templates := template.New("main.html").Funcs(funcMap)
256 files, err := ioutil.ReadDir("./internal/port/tpl") 256
257 if err != nil { 257 for _, filename := range tplBox.List() {
258 return err
259 }
260 for _, file := range files {
261 filename := file.Name()
262 if strings.HasSuffix(filename, ".html") { 258 if strings.HasSuffix(filename, ".html") {
263 allFiles = append(allFiles, "./internal/port/tpl/"+filename) 259 tplStr, _ := tplBox.FindString(filename)
260 templates, _ = templates.New(filename).Parse(tplStr)
264 } 261 }
265 } 262 }
266 263
267 templates, err = template.New("main.html").Funcs(funcMap).ParseFiles(allFiles...)
268 if err != nil {
269 return err
270 }
271
272 // 264 //
273 265
274 startpageTpl := templates.Lookup("startpage.html") 266 startpageTpl := templates.Lookup("startpage.html")