summaryrefslogtreecommitdiffstats
path: root/tpl
diff options
context:
space:
mode:
Diffstat (limited to 'tpl')
-rw-r--r--tpl/partials/partials.go41
1 files changed, 20 insertions, 21 deletions
diff --git a/tpl/partials/partials.go b/tpl/partials/partials.go
index 266329721..dba0e5013 100644
--- a/tpl/partials/partials.go
+++ b/tpl/partials/partials.go
@@ -74,36 +74,35 @@ func (ns *Namespace) Include(name string, contextList ...interface{}) (interface
context = contextList[0]
}
- for _, n := range []string{"partials/" + name, "theme/partials/" + name} {
- templ, found := ns.deps.Tmpl.Lookup(n)
+ n := "partials/" + name
+ templ, found := ns.deps.Tmpl.Lookup(n)
- if !found {
- // For legacy reasons.
- templ, found = ns.deps.Tmpl.Lookup(n + ".html")
- }
- if found {
- b := bp.GetBuffer()
- defer bp.PutBuffer(b)
-
- if err := templ.Execute(b, context); err != nil {
- return "", err
- }
+ if !found {
+ // For legacy reasons.
+ templ, found = ns.deps.Tmpl.Lookup(n + ".html")
+ }
+ if found {
+ b := bp.GetBuffer()
+ defer bp.PutBuffer(b)
- if _, ok := templ.(*texttemplate.Template); ok {
- s := b.String()
- if ns.deps.Metrics != nil {
- ns.deps.Metrics.TrackValue(n, s)
- }
- return s, nil
- }
+ if err := templ.Execute(b, context); err != nil {
+ return "", err
+ }
+ if _, ok := templ.(*texttemplate.Template); ok {
s := b.String()
if ns.deps.Metrics != nil {
ns.deps.Metrics.TrackValue(n, s)
}
- return template.HTML(s), nil
+ return s, nil
+ }
+ s := b.String()
+ if ns.deps.Metrics != nil {
+ ns.deps.Metrics.TrackValue(n, s)
}
+ return template.HTML(s), nil
+
}
return "", fmt.Errorf("Partial %q not found", name)