summaryrefslogtreecommitdiff
path: root/internal/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers.go')
-rw-r--r--internal/handlers.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/handlers.go b/internal/handlers.go
index 5d66be8..09fcaec 100644
--- a/internal/handlers.go
+++ b/internal/handlers.go
@@ -40,7 +40,21 @@ func (s *Server) handleHTMXPage(c echo.Context) error {
if !validPage(page) {
return c.String(http.StatusNotFound, "Page not found")
}
- return s.renderContent(c, page, PageSections[page][0])
+
+ content, err := s.tmpl.GetContent(page, PageSections[page][0])
+ if err != nil {
+ log.Printf("Error rendering content for %s: %v", page, err)
+ return c.String(http.StatusInternalServerError, "Error loading content")
+ }
+
+ data := PageData{
+ Page: page,
+ Pages: ValidPages,
+ Sections: PageSections[page],
+ Content: content,
+ }
+
+ return c.Render(http.StatusOK, "page.html", data)
}
func (s *Server) handleHTMXSection(c echo.Context) error {