feat(custom): config and generation
This commit is contained in:
parent
730ec34758
commit
279f73187b
4 changed files with 111 additions and 7 deletions
14
main.go
14
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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue