|
|
|
@ -40,7 +40,7 @@ func (app *application) renderTemplate(
|
|
|
|
|
) error {
|
|
|
|
|
var t *template.Template
|
|
|
|
|
var err error
|
|
|
|
|
templateToRender := fmt.Sprintf("templates/%s.page.tmpl", page)
|
|
|
|
|
templateToRender := fmt.Sprintf("templates/%s.page.gohtml", page)
|
|
|
|
|
|
|
|
|
|
_, templateInMap := app.templateCache[templateToRender]
|
|
|
|
|
|
|
|
|
@ -79,15 +79,15 @@ func (app *application) parseTemplate(
|
|
|
|
|
// build partials
|
|
|
|
|
if len(partials) > 0 {
|
|
|
|
|
for i, x := range partials {
|
|
|
|
|
partials[i] = fmt.Sprintf("tempaltes/%s.partial.tmpl", x)
|
|
|
|
|
partials[i] = fmt.Sprintf("tempaltes/%s.partial.gohtml", x)
|
|
|
|
|
}
|
|
|
|
|
t, err = template.New(fmt.Sprintf("%s.page.tmpl", page)).
|
|
|
|
|
t, err = template.New(fmt.Sprintf("%s.page.gohtml", page)).
|
|
|
|
|
Funcs(functions).
|
|
|
|
|
ParseFS(templateFS, "templates/base.layout.tmpl", strings.Join(partials, ","), templateToRender)
|
|
|
|
|
ParseFS(templateFS, "templates/base.layout.gohtml", strings.Join(partials, ","), templateToRender)
|
|
|
|
|
} else {
|
|
|
|
|
t, err = template.New(fmt.Sprintf("%s.page.tmpl", page)).
|
|
|
|
|
t, err = template.New(fmt.Sprintf("%s.page.gohtml", page)).
|
|
|
|
|
Funcs(functions).
|
|
|
|
|
ParseFS(templateFS, "templates/base.layout.tmpl", templateToRender)
|
|
|
|
|
ParseFS(templateFS, "templates/base.layout.gohtml", templateToRender)
|
|
|
|
|
}
|
|
|
|
|
if err != nil {
|
|
|
|
|
app.errorLog.Println(err)
|
|
|
|
|