mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-03 21:20:58 +00:00
Allow partial without .html
`partial "header" .` means the same thing as `partial "header.html" .`.
This commit is contained in:
parent
266511b6d3
commit
d7e6e490c2
1 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue