Move section initialization to Site.assembleSections
authornitoyon <nitoyon@gmail.com>
Tue, 27 Oct 2015 16:55:57 +0000 (01:55 +0900)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 9 Apr 2016 18:13:35 +0000 (20:13 +0200)
Closes #1527

hugolib/site.go

index f7615170cd30817929506b19fd8f186639f5b117..92fd2ffab7f58e8eb978b9edffda554982cb8319 100644 (file)
@@ -1243,7 +1243,6 @@ func (s *Site) assembleMenus() {
 
 func (s *Site) assembleTaxonomies() {
        s.Taxonomies = make(TaxonomyList)
-       s.Sections = make(Taxonomy)
 
        taxonomies := viper.GetStringMapString("Taxonomies")
        jww.INFO.Printf("found taxonomies: %#v\n", taxonomies)
@@ -1276,7 +1275,6 @@ func (s *Site) assembleTaxonomies() {
        }
 
        s.Info.Taxonomies = s.Taxonomies
-       s.Info.Sections = s.Sections
 }
 
 // Prepare pages for a new full build.
@@ -1291,6 +1289,9 @@ func (s *Site) resetPageBuildState() {
 }
 
 func (s *Site) assembleSections() {
+       s.Sections = make(Taxonomy)
+       s.Info.Sections = s.Sections
+
        for i, p := range s.Pages {
                s.Sections.add(p.Section(), WeightedPage{s.Pages[i].Weight, s.Pages[i]}, s.Info.preserveTaxonomyNames)
        }