fix template parse bug

This commit is contained in:
Erik Winter 2020-12-31 08:41:51 +01:00
parent 941b1dfbbf
commit bd3d7bfe23
2 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
shitty-ssg
public

View File

@ -54,15 +54,15 @@ func NewSiteConfig(id SiteID) (*SiteConfig, error) {
func (sc *SiteConfig) ParseTemplates(tplPath string) error {
for _, tplConf := range sc.TemplateConfigs {
var tFiles []string
for _, tName := range tplConf.TemplateNames {
var tFiles []string
tFiles = append(tFiles, filepath.Join(tplPath, fmt.Sprintf("%s.%s", tName, tplConf.TemplateExt)))
tpl, err := template.ParseFiles(tFiles...)
if err != nil {
return err
}
tplConf.Template = tpl
}
tpl, err := template.ParseFiles(tFiles...)
if err != nil {
return err
}
tplConf.Template = tpl
}
return nil