28 lines
456 B
Go
28 lines
456 B
Go
package render
|
|
|
|
import (
|
|
"html/template"
|
|
"io"
|
|
)
|
|
|
|
var (
|
|
templates = template.Must(template.ParseGlob("views/*.tmpl"))
|
|
)
|
|
|
|
type MetaTags struct {
|
|
Title string
|
|
Description string
|
|
Image string
|
|
}
|
|
|
|
func init() {
|
|
templates.Funcs(template.FuncMap{
|
|
"html": func(s string) template.HTML {
|
|
return template.HTML(s)
|
|
},
|
|
})
|
|
}
|
|
|
|
func Template(writer io.Writer, name string, data any) error {
|
|
return templates.ExecuteTemplate(writer, name, data)
|
|
} |