fix template parse bug
This commit is contained in:
parent
941b1dfbbf
commit
bd3d7bfe23
|
@ -1,2 +1,3 @@
|
||||||
shitty-ssg
|
shitty-ssg
|
||||||
|
public
|
||||||
|
|
||||||
|
|
|
@ -54,16 +54,16 @@ func NewSiteConfig(id SiteID) (*SiteConfig, error) {
|
||||||
|
|
||||||
func (sc *SiteConfig) ParseTemplates(tplPath string) error {
|
func (sc *SiteConfig) ParseTemplates(tplPath string) error {
|
||||||
for _, tplConf := range sc.TemplateConfigs {
|
for _, tplConf := range sc.TemplateConfigs {
|
||||||
for _, tName := range tplConf.TemplateNames {
|
|
||||||
var tFiles []string
|
var tFiles []string
|
||||||
|
for _, tName := range tplConf.TemplateNames {
|
||||||
tFiles = append(tFiles, filepath.Join(tplPath, fmt.Sprintf("%s.%s", tName, tplConf.TemplateExt)))
|
tFiles = append(tFiles, filepath.Join(tplPath, fmt.Sprintf("%s.%s", tName, tplConf.TemplateExt)))
|
||||||
|
}
|
||||||
tpl, err := template.ParseFiles(tFiles...)
|
tpl, err := template.ParseFiles(tFiles...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tplConf.Template = tpl
|
tplConf.Template = tpl
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue