From 77aa7a5e63f38df124ff8f236a867e3ebecce4d9 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Wed, 19 Jun 2024 01:06:33 +0400 Subject: [PATCH] Call Index template right in-place. --- cmd/dwelling-home/main.go | 3 ++- internal/http/web_handlers.go | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/dwelling-home/main.go b/cmd/dwelling-home/main.go index 9617ad4..e86a1e7 100644 --- a/cmd/dwelling-home/main.go +++ b/cmd/dwelling-home/main.go @@ -16,6 +16,7 @@ import ( "git.arav.su/Arav/dwelling-home/web" "git.arav.su/Arav/httpr" gb "git.arav.su/Arav/justguestbook" + "github.com/a-h/templ" ) var version string @@ -65,7 +66,7 @@ func main() { r.Handler(http.MethodGet, "/rss.xml", hand.RSS) r.Handler(http.MethodGet, "/sitemap.xml", dwhttp.ServeAsset("sitemap.xml")) - r.Handler(http.MethodGet, "/", hand.Index) + r.Handler(http.MethodGet, "/", templ.Handler(web.Index()).ServeHTTP) r.Handler(http.MethodGet, "/privacy", hand.Privacy) r.Handler(http.MethodGet, "/stuff", hand.Stuff) r.Handler(http.MethodGet, "/stuff/article/*filepath", hand.Article) diff --git a/internal/http/web_handlers.go b/internal/http/web_handlers.go index a829fba..378e471 100644 --- a/internal/http/web_handlers.go +++ b/internal/http/web_handlers.go @@ -36,10 +36,6 @@ func NewHandlers(captchaExpire time.Duration, owner string, gbPageSize int64, guestbookPageSize: gbPageSize} } -func (h *Handlers) Index(w http.ResponseWriter, r *http.Request) { - web.Index().Render(context.Background(), w) -} - func (h *Handlers) Privacy(w http.ResponseWriter, r *http.Request) { web.Privacy("/ Privacy statements",