31 lines
651 B
Go
31 lines
651 B
Go
|
package handlers
|
||
|
|
||
|
import (
|
||
|
"html/template"
|
||
|
|
||
|
"git.vbrandl.net/vbrandl/go-web-template/assets"
|
||
|
)
|
||
|
|
||
|
var indexTemplate *template.Template
|
||
|
var notFoundTemplate *template.Template
|
||
|
|
||
|
type templateData struct {
|
||
|
RequestID string
|
||
|
}
|
||
|
|
||
|
func (app *Application) ParseTemplates() error {
|
||
|
t, err := template.ParseFS(assets.Templates, "public/html/index.html", "public/html/navbar.tmpl", "public/html/footer.tmpl")
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
indexTemplate = t
|
||
|
|
||
|
t, err = template.ParseFS(assets.Templates, "public/html/notFound.html", "public/html/navbar.tmpl", "public/html/footer.tmpl")
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
notFoundTemplate = t
|
||
|
|
||
|
return nil
|
||
|
}
|