From cdbc741cb8a9fae3909f9d108fc62e5bacf26657 Mon Sep 17 00:00:00 2001 From: spf13 Date: Mon, 24 Nov 2014 17:10:38 -0500 Subject: [PATCH] fixed #656. Templates work properly when watching. --- hugolib/site.go | 2 +- tpl/template.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hugolib/site.go b/hugolib/site.go index dd02d79f5..b725cc411 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -167,7 +167,7 @@ func (s *Site) Analyze() { } func (s *Site) prepTemplates() { - s.Tmpl = tpl.T() + s.Tmpl = tpl.InitializeT() s.Tmpl.LoadTemplates(s.absLayoutDir()) if s.hasTheme() { s.Tmpl.LoadTemplatesWithPrefix(s.absThemeDir()+"/layouts", "theme") diff --git a/tpl/template.go b/tpl/template.go index b79b478eb..b536c4626 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -66,6 +66,12 @@ func T() Template { return tmpl } +// Resets the internal template state to it's initial state +func InitializeT() Template { + tmpl = New() + return tmpl +} + // Return a new Hugo Template System // With all the additional features, templates & functions func New() Template {