diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-02-10 17:26:28 +0700 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-02-10 18:57:38 +0700 |
commit | 2618cfbeaa06bd2a4d26b3e3999e3c9ca9a49854 (patch) | |
tree | 40715bf14911177c527225398cb02b6a849f3788 /tpl | |
parent | 25bfa7e12fcd044368e9983481dfd4bfc8558a55 (diff) |
hugolib: Fix error for non-renderable HTML content with shortcodes
This commit re-introduces template lookup order that was accidently removed as
part of the template nonglobal refactoring.
Fixes #3021
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/template.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tpl/template.go b/tpl/template.go index 9efb8869a..844608014 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -141,7 +141,6 @@ func (t *GoHTMLTemplate) initFuncs(d *deps.Deps) { // Hacky, but we need to make sure that the func names are in the global map. amber.FuncMap[k] = func() string { panic("should never be invoked") - return "" } } @@ -197,12 +196,18 @@ func (t *GoHTMLTemplate) ExecuteTemplateToHTML(context interface{}, layouts ...s func (t *GoHTMLTemplate) Lookup(name string) *template.Template { + if templ := t.Template.Lookup(name); templ != nil { + return templ + } + if t.overlays != nil { if templ, ok := t.overlays[name]; ok { return templ } } + // The clone is used for the non-renderable HTML pages (p.IsRenderable == false) that is parsed + // as Go templates late in the build process. if t.clone != nil { if templ := t.clone.Lookup(name); templ != nil { return templ |