Fix template checking order in site.go
authorChase Adams <chaadams@zappos.com>
Fri, 14 Nov 2014 17:14:52 +0000 (09:14 -0800)
committerspf13 <steve.francia@gmail.com>
Mon, 17 Nov 2014 23:42:36 +0000 (18:42 -0500)
- Change order of HasPrefix to match correct order
- Remove theme concatenation to _internal in last loop of
  appendthemetemplates so it looks in the right place for internal
templates

Conflicts:
hugolib/site.go

hugolib/site.go

index a79fa9f84820347a742aff7ac3dbe84d38908abe..28e6f0a583444ee0cb912235d2613ae28c48c3b7 100644 (file)
@@ -766,21 +766,22 @@ func (s *Site) appendThemeTemplates(in []string) []string {
                out := []string{}
                // First place all non internal templates
                for _, t := range in {
-                       if !strings.HasPrefix("_internal/", t) {
+                       if !strings.HasPrefix(t, "_internal/") {
                                out = append(out, t)
                        }
                }
 
                // Then place theme templates with the same names
                for _, t := range in {
-                       if !strings.HasPrefix("_internal/", t) {
+                       if !strings.HasPrefix(t, "_internal/") {
                                out = append(out, "theme/"+t)
                        }
                }
+
                // Lastly place internal templates
                for _, t := range in {
-                       if strings.HasPrefix("_internal/", t) {
-                               out = append(out, "theme/"+t)
+                       if strings.HasPrefix(t, "_internal/") {
+                               out = append(out, t)
                        }
                }
                return out
@@ -936,6 +937,7 @@ func (s *Site) RenderSectionLists() error {
 
                if !viper.GetBool("DisableRSS") {
                        // XML Feed
+                       fmt.Println("Section...")
                        rssLayouts := []string{"section/" + section + ".rss.xml", "_default/rss.xml", "rss.xml", "_internal/_default/rss.xml"}
                        s.setUrls(n, section+".xml")
                        b, err = s.renderXML("section "+section+" rss", n, s.appendThemeTemplates(rssLayouts)...)