mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user