aboutsummaryrefslogtreecommitdiff
path: root/render.go
diff options
context:
space:
mode:
authorAlex <alex@scerba.org>2024-03-13 17:09:48 -0400
committerAlex Scerba <alex@scerba.org>2024-10-29 13:20:01 -0400
commitf97d476b495126fd2474b8e3a2968658395d2a0f (patch)
tree866ce2531ea9ada192e01faeecd42fc02bc5b0c1 /render.go
parent99d92792daedc0501886edc7c4e4a9f3768f9b8a (diff)
Complete restructure
Diffstat (limited to 'render.go')
-rw-r--r--render.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/render.go b/render.go
deleted file mode 100644
index 83416f5..0000000
--- a/render.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package main
-
-import (
- "net/http"
- "strings"
- "text/template"
-)
-
-func renderTemplate(w http.ResponseWriter, tmplPath string, p *Posts) (err error) {
- t, err := template.ParseFiles("html/master.tmpl.html", "html/"+tmplPath+".tmpl.html")
- if err != nil {
- return err
- }
-
- data := combineData(tmplPath, p)
-
- err = t.Execute(w, data)
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func combineData(path string, p *Posts) map[string]interface{} {
- splitPath := strings.Split(path, "/")
-
- data := make(map[string]interface{})
-
- if splitPath[0] == "main" {
- switch splitPath[1] {
- case "about":
- data["Page"] = splitPath[1]
- default:
- data["Page"] = splitPath[1]
- data["Posts"] = p
- }
- } else {
- data["Page"] = splitPath[0]
- data["Post"] = p.Contents[0]
- }
-
- return data
-}