tpl: Must do a extra lookup of cloned base templates
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 7 Feb 2017 03:43:30 +0000 (10:43 +0700)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 7 Feb 2017 03:43:30 +0000 (10:43 +0700)
See #2549
Fixes #3013

tpl/template.go

index 1c71989f47193b89144186847b91b55f5291c373..9efb8869ac09cff6bec599ae4cc4e89e4352d4b6 100644 (file)
@@ -109,6 +109,10 @@ func (*TemplateProvider) Clone(d *deps.Deps) error {
 
        for k, v := range t.overlays {
                vc := template.Must(v.Clone())
+               // The extra lookup is a workaround, see
+               // * https://github.com/golang/go/issues/16101
+               // * https://github.com/spf13/hugo/issues/2549
+               vc = vc.Lookup(vc.Name())
                vc.Funcs(tmpl.funcster.funcMap)
                tmpl.overlays[k] = vc
        }