ref: 0b91053c9fb5a56a28866a933868b0fc7807b24f
parent: 396276aafa9f81b9a3c533c5b9b1eb4282db505b
author: Bjørn Erik Pedersen <[email protected]>
date: Tue Feb 28 04:06:33 EST 2017
hugolib: Only consider regular pages in Prev/Next Fixes #3108
--- a/hugolib/hugo_sites_build_test.go
+++ b/hugolib/hugo_sites_build_test.go
@@ -370,6 +370,19 @@
require.Equal(t, "Home", enSite.Menus["main"].ByName()[0].Name)
require.Equal(t, "Heim", nnSite.Menus["main"].ByName()[0].Name)
+ // Issue #3108
+ next := enSite.RegularPages[0].Next
+ require.NotNil(t, next)
+ require.Equal(t, KindPage, next.Kind)
+
+ for {
+ if next == nil {
+ break
+ }
+ require.Equal(t, KindPage, next.Kind)
+ next = next.Next
+ }
+
}
func TestMultiSitesRebuild(t *testing.T) {
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -824,13 +824,13 @@
func (s *Site) setupSitePages() {
var siteLastChange time.Time
- for i, page := range s.Pages {
- if i < len(s.Pages)-1 {
- page.Next = s.Pages[i+1]
+ for i, page := range s.RegularPages {
+ if i < len(s.RegularPages)-1 {
+ page.Next = s.RegularPages[i+1]
}
if i > 0 {
- page.Prev = s.Pages[i-1]
+ page.Prev = s.RegularPages[i-1]
}
// Determine Site.Info.LastChange