node to page: Fix site pages sort

Updates #2297
This commit is contained in:
Bjørn Erik Pedersen 2016-11-21 10:35:57 +01:00
parent 976f8f84bf
commit 0eb5f54d30

View file

@ -295,12 +295,23 @@ func (h *HugoSites) createMissingPages() error {
} }
if len(newPages) > 0 { if len(newPages) > 0 {
// This resorting is unfortunate, but it also needs to be sorted
// when sections are created.
first := h.Sites[0] first := h.Sites[0]
first.AllPages = append(first.AllPages, newPages...) 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++ { for i := 1; i < len(h.Sites); i++ {
h.Sites[i].AllPages = first.AllPages h.Sites[i].AllPages = first.AllPages
} }
} }
return nil return nil
} }