hugolib: Only consider regular pages in Prev/Next

Fixes #3108
This commit is contained in:
Bjørn Erik Pedersen 2017-02-28 09:06:33 +01:00
parent 396276aafa
commit 0b91053c9f
2 changed files with 17 additions and 4 deletions

View file

@ -370,6 +370,19 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) {
require.Equal(t, "Home", enSite.Menus["main"].ByName()[0].Name) require.Equal(t, "Home", enSite.Menus["main"].ByName()[0].Name)
require.Equal(t, "Heim", nnSite.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) { func TestMultiSitesRebuild(t *testing.T) {

View file

@ -824,13 +824,13 @@ func (s *Site) process(config BuildCfg) (err error) {
func (s *Site) setupSitePages() { func (s *Site) setupSitePages() {
var siteLastChange time.Time var siteLastChange time.Time
for i, page := range s.Pages { for i, page := range s.RegularPages {
if i < len(s.Pages)-1 { if i < len(s.RegularPages)-1 {
page.Next = s.Pages[i+1] page.Next = s.RegularPages[i+1]
} }
if i > 0 { if i > 0 {
page.Prev = s.Pages[i-1] page.Prev = s.RegularPages[i-1]
} }
// Determine Site.Info.LastChange // Determine Site.Info.LastChange