diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index 0da7efb88..843bfe82f 100644 --- 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 }