Anpassung für dynamische Content-Gits
Some checks failed
release-tag / release-image (push) Failing after 43s
Some checks failed
release-tag / release-image (push) Failing after 43s
This commit is contained in:
@@ -57,6 +57,11 @@ func main() {
|
||||
staticDir = "/pages"
|
||||
}
|
||||
|
||||
templatesDir := os.Getenv("BLOG_TEMPLATES_DIR")
|
||||
if templatesDir == "" {
|
||||
templatesDir = "/templates"
|
||||
}
|
||||
|
||||
funcs := template.FuncMap{
|
||||
"now": time.Now, // jetzt‑Zeit 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"),
|
||||
)
|
||||
|
||||
// LIST‑Seite: 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"))
|
||||
|
||||
// ARTICLE‑Instanz
|
||||
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()
|
||||
|
||||
|
Reference in New Issue
Block a user