feat(custom): config and generation

This commit is contained in:
Anhgelus Morhtuuzh 2024-12-10 19:00:56 +01:00
parent 730ec34758
commit 279f73187b
No known key found for this signature in database
GPG key ID: CAD341EFA92DDDE5
4 changed files with 111 additions and 7 deletions

14
main.go
View file

@ -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)
}