Anpassung für dynamische Content-Gits
Some checks failed
release-tag / release-image (push) Failing after 43s

This commit is contained in:
2025-05-10 19:13:29 +02:00
parent d7726b57e4
commit 12ce629b31
3 changed files with 29 additions and 5 deletions

View File

@@ -57,6 +57,11 @@ func main() {
staticDir = "/pages"
}
templatesDir := os.Getenv("BLOG_TEMPLATES_DIR")
if templatesDir == "" {
templatesDir = "/templates"
}
funcs := template.FuncMap{
"now": time.Now, // jetztZeit bereitstellen
}
@@ -64,19 +69,19 @@ func main() {
// Basislayout zuerst parsen
layout := template.Must(
template.New("base").Funcs(funcs).
ParseFiles("/app/internal/web/templates/base.html"),
ParseFiles(templatesDir + "/base.html"),
)
// LISTSeite: base + list.html
tplList = template.Must(layout.Clone())
template.Must(tplList.Funcs(funcs).ParseFiles("/app/internal/web/templates/list.html"))
template.Must(tplList.Funcs(funcs).ParseFiles(templatesDir + "/list.html"))
// ARTICLEInstanz
tplArticle = template.Must(layout.Clone())
template.Must(tplArticle.Funcs(funcs).ParseFiles("/app/internal/web/templates/article.html"))
template.Must(tplArticle.Funcs(funcs).ParseFiles(templatesDir + "/article.html"))
tplPage := template.Must(layout.Clone())
template.Must(tplPage.ParseFiles("/app/internal/web/templates/page.html"))
template.Must(tplPage.ParseFiles(templatesDir + "/page.html"))
mux := http.NewServeMux()