21 lines
351 B
Go
21 lines
351 B
Go
|
package html
|
||
|
|
||
|
import (
|
||
|
"embed"
|
||
|
"html/template"
|
||
|
"io"
|
||
|
)
|
||
|
|
||
|
//go:embed *.html
|
||
|
var templates embed.FS
|
||
|
|
||
|
func load(file string) *template.Template {
|
||
|
return template.Must(template.New("layout.html").ParseFS(templates, "layout.html", file))
|
||
|
}
|
||
|
|
||
|
var home = load("home.html")
|
||
|
|
||
|
func Home(writer io.Writer, data any) error {
|
||
|
return home.Execute(writer, data)
|
||
|
}
|