From d7e6e490c2d6d894b2f4ac38b63d05f4744e802f Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Sat, 1 Nov 2014 00:15:22 -0400 Subject: [PATCH] Allow partial without .html `partial "header" .` means the same thing as `partial "header.html" .`. --- hugolib/template.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hugolib/template.go b/hugolib/template.go index 20c57701d..2de1396f7 100644 --- a/hugolib/template.go +++ b/hugolib/template.go @@ -563,10 +563,16 @@ func ExecuteTemplate(context interface{}, layouts ...string) *bytes.Buffer { buffer := new(bytes.Buffer) worked := false for _, layout := range layouts { - if localTemplates.Lookup(layout) != nil { - err := localTemplates.ExecuteTemplate(buffer, layout, context) + name := layout + + if localTemplates.Lookup(name) == nil { + name = layout + ".html" + } + + if localTemplates.Lookup(name) != nil { + err := localTemplates.ExecuteTemplate(buffer, name, context) if err != nil { - jww.ERROR.Println(err, "in", layout) + jww.ERROR.Println(err, "in", name) } worked = true break