hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 0eb5f54d30e950c467d5d4473fd1fb8cbff47694
parent 976f8f84bfe36f2c9e2ec6992b15dbb70c812af5
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Mon, 21 Nov 2016 10:35:57 +0100

node to page: Fix site pages sort

Updates #2297

Diffstat:
Mhugolib/hugo_sites.go | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go
@@ -295,12 +295,23 @@ func (h *HugoSites) createMissingPages() error {
 	}
 
 	if len(newPages) > 0 {
+		// This resorting is unfortunate, but it also needs to be sorted
+		// when sections are created.
 		first := h.Sites[0]
+
 		first.AllPages = append(first.AllPages, newPages...)
+
+		first.AllPages.Sort()
+
+		for _, s := range h.Sites {
+			s.Pages.Sort()
+		}
+
 		for i := 1; i < len(h.Sites); i++ {
 			h.Sites[i].AllPages = first.AllPages
 		}
 	}
+
 	return nil
 }