From 279f73187b9de250de3b1788d1ce543c60832bc6 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Tue, 10 Dec 2024 19:00:56 +0100 Subject: feat(custom): config and generation --- main.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 57ef485..cd23aea 100644 --- a/main.go +++ b/main.go @@ -50,6 +50,10 @@ func main() { if err != nil { panic(err) } + customPages, err := cfg.LoadCustomPages() + if err != nil { + panic(err) + } g := golatt.New(templates) g.DefaultSeoData = &golatt.SeoData{ Image: cfg.Image, @@ -74,6 +78,16 @@ func main() { &cfg). Handle() + for _, cp := range customPages { + g.NewTemplate("custom_page", + cp.URI, + cp.Title, + cp.Image, + cp.Description, + cp). + Handle() + } + g.NotFoundHandler = func(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/", http.StatusTemporaryRedirect) } -- cgit v1.2.3 From e379601ec1f1ca70f955f7ea9dd07775fb4da93b Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Tue, 10 Dec 2024 19:13:44 +0100 Subject: fix(custom): missing method for new config --- main.go | 1 + 1 file changed, 1 insertion(+) (limited to 'main.go') diff --git a/main.go b/main.go index cd23aea..34086cc 100644 --- a/main.go +++ b/main.go @@ -79,6 +79,7 @@ func main() { Handle() for _, cp := range customPages { + slog.Info("Creating custom page...", "title", cp.Title, "uri", cp.URI) g.NewTemplate("custom_page", cp.URI, cp.Title, -- cgit v1.2.3