From 3529152efe321b2c26636c2f04a508cf9133991c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 17 Mar 2016 23:36:11 +0100 Subject: [PATCH] Return early from appendThemeTemplates --- hugolib/site.go | 50 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/hugolib/site.go b/hugolib/site.go index a0324e230..5ff71b6cc 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -1448,31 +1448,33 @@ func errorCollator(results <-chan error, errs chan<- error) { } func (s *Site) appendThemeTemplates(in []string) []string { - if s.hasTheme() { - out := []string{} - // First place all non internal templates - for _, t := range in { - if !strings.HasPrefix(t, "_internal/") { - out = append(out, t) - } - } - - // Then place theme templates with the same names - for _, t := range in { - if !strings.HasPrefix(t, "_internal/") { - out = append(out, "theme/"+t) - } - } - - // Lastly place internal templates - for _, t := range in { - if strings.HasPrefix(t, "_internal/") { - out = append(out, t) - } - } - return out + if !s.hasTheme() { + return in } - return in + + out := []string{} + // First place all non internal templates + for _, t := range in { + if !strings.HasPrefix(t, "_internal/") { + out = append(out, t) + } + } + + // Then place theme templates with the same names + for _, t := range in { + if !strings.HasPrefix(t, "_internal/") { + out = append(out, "theme/"+t) + } + } + + // Lastly place internal templates + for _, t := range in { + if strings.HasPrefix(t, "_internal/") { + out = append(out, t) + } + } + return out + } type taxRenderInfo struct {