Added blog posts, and improved homepage

This commit is contained in:
2025-05-23 18:12:16 +02:00
parent 99ab5d388c
commit 847fb6491d
28 changed files with 721 additions and 132 deletions

View File

@@ -3,17 +3,13 @@ package pages
import (
"html/template"
"net/http"
"prettysunflower-website/baseTemplates"
)
func homepage(w http.ResponseWriter, r *http.Request) {
templateFile := "templates/homepage.tmpl"
files, err := template.New(templateFile).ParseFS(content, templateFile)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
files := template.Must(template.ParseFS(baseTemplates.FS, "templates/base.tmpl", "templates/pages/homepage.tmpl"))
err = files.ExecuteTemplate(w, "homepage.tmpl", nil)
err := files.ExecuteTemplate(w, "base", nil)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)