Add workaround for block template crash
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 14 Oct 2016 09:01:49 +0000 (11:01 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 14 Oct 2016 09:01:49 +0000 (11:01 +0200)
Fixes #2549

tpl/template.go

index 2039548bf6bc78820f0962eaa9a98bba37ba4a8e..1fba368e4fcae1ebce6802f2bf5dad1fb45ec2e0 100644 (file)
@@ -257,7 +257,10 @@ func (t *GoHTMLTemplate) AddTemplateFileWithMaster(name, overlayFilename, master
        if err != nil {
                t.errors = append(t.errors, &templateErr{name: name, err: err})
        } else {
-               t.overlays[name] = overlayTpl
+               // The extra lookup is a workaround, see
+               // * https://github.com/golang/go/issues/16101
+               // * https://github.com/spf13/hugo/issues/2549
+               t.overlays[name] = overlayTpl.Lookup(overlayTpl.Name())
        }
 
        return err