Implement template helper funcs

pull/1/head
Nikita Tokarchuk 3 years ago
parent 422bcbf82c
commit 8f4d4ff1ba
Signed by: mainnika
GPG Key ID: A595FB7E3E56911C
  1. 11
      frontend/templates/funcs.go
  2. 1
      frontend/templates/templates.go

@ -0,0 +1,11 @@
package templates
import "html/template"
func UseFuncs() template.FuncMap {
return template.FuncMap{
"getIndexURL": func() string {
return URLIndex
},
}
}

@ -25,6 +25,7 @@ var Templates *template.Template
func init() { func init() {
Templates = template.New("") Templates = template.New("")
Templates.Funcs(UseFuncs())
tmplNames, err := fs.Glob(content, "*.go.tmpl") tmplNames, err := fs.Glob(content, "*.go.tmpl")
if err != nil { if err != nil {

Loading…
Cancel
Save