This commit is contained in:
jdl
2026-06-14 20:00:36 +02:00
parent f301bec9ef
commit 43067677ec
10 changed files with 164 additions and 4 deletions

View File

@@ -4,7 +4,6 @@ import (
"embed"
"html/template"
"io/fs"
"log"
"path"
"strings"
)
@@ -46,12 +45,10 @@ func loadTemplateDir(
shareDir := path.Join(dirPath, "share")
if _, err := fs.ReadDir(shareDir); err == nil {
log.Printf("Parsing %s...", path.Join(shareDir, "*"))
t = template.Must(t.ParseFS(fs, path.Join(shareDir, "*")))
}
if data, _ := fs.ReadFile(path.Join(dirPath, "base.html")); data != nil {
log.Printf("Parsing %s...", path.Join(dirPath, "base.html"))
t = template.Must(t.Parse(string(data)))
}
@@ -72,7 +69,6 @@ func loadTemplateDir(
}
filePath := path.Join(dirPath, ent.Name())
log.Printf("Parsing %s...", filePath)
key := strings.TrimPrefix(path.Join(dirPath, ent.Name()), rootDir)
tt := template.Must(t.Clone())