This commit is contained in:
xing 2022-11-04 12:25:00 +08:00
parent 57d220078c
commit 2c24800b78

View File

@ -2,7 +2,6 @@ package templates
import ( import (
"embed" "embed"
"fmt"
"github.com/gin-gonic/gin/render" "github.com/gin-gonic/gin/render"
"html/template" "html/template"
"io/fs" "io/fs"
@ -31,7 +30,7 @@ func (t *FsTemplate) SetTemplate() *FsTemplate {
name := filepath.Base(include) name := filepath.Base(include)
c := strings.Split(include, "/") c := strings.Split(include, "/")
base := c[0] base := c[0]
t.Templates[include] = template.Must(template.New(name).Funcs(t.FuncMap).ParseFS(TemplateFs, include, fmt.Sprintf("%s/layout/*.gohtml", base))) t.Templates[include] = template.Must(template.New(name).Funcs(t.FuncMap).ParseFS(TemplateFs, include, filepath.Join(base, "layout/*.gohtml")))
} }
return t return t
} }