Return early from appendThemeTemplates
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 17 Mar 2016 22:36:11 +0000 (23:36 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 17 Mar 2016 22:36:11 +0000 (23:36 +0100)
hugolib/site.go

index a0324e2302f0f981312c96c82b0bdddeb93c5209..5ff71b6cc19171e3b0f4652e95a3703710e49d5b 100644 (file)
@@ -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)
-                       }
+       if !s.hasTheme() {
+               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)
-                       }
+       // 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)
-                       }
+       // Lastly place internal templates
+       for _, t := range in {
+               if strings.HasPrefix(t, "_internal/") {
+                       out = append(out, t)
                }
-               return out
        }
-       return in
+       return out
+
 }
 
 type taxRenderInfo struct {