aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorWilliam Hergès <anhgelus@anhgelus.world>2024-12-10 20:47:56 +0100
committerGitHub <noreply@github.com>2024-12-10 20:47:56 +0100
commit0149f9905c2830441d9ccfeccbb02e4ebf60a0d8 (patch)
tree52ffaeaea8534a2f4771a2c8a353b37f6a97f566 /main.go
parent730ec347582289efbc0cd1c48e4c243d4c4920d6 (diff)
parent40fe301b5462b84e06747ff30add26b4259d38a4 (diff)
Merge pull request #1 from anhgelus/feat/custom-page
[Feat] Custom page
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/main.go b/main.go
index 57ef485..34086cc 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,17 @@ func main() {
&cfg).
Handle()
+ for _, cp := range customPages {
+ slog.Info("Creating custom page...", "title", cp.Title, "uri", cp.URI)
+ 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)
}