hugolib: Fix .Sections vs siblings
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 26 Nov 2019 12:12:44 +0000 (13:12 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 26 Nov 2019 12:12:44 +0000 (13:12 +0100)
Fixes #6365

hugolib/pages_map.go
hugolib/site_sections_test.go

index b5b47ccafe4d90dde5f5ee11a2f184d04a133234..bc8589142c6993a460201bc445e870d34a6f7be0 100644 (file)
@@ -176,8 +176,6 @@ func (m *pagesMap) addPage(p *pageState) {
        }
 
        bucket = v.(*pagesMapBucket)
-       p.bucket = bucket
-
        bucket.pages = append(bucket.pages, p)
 }
 
index 3cd2a06bb4097a0ed35f8e35ff8f3af28e5f7a4d..eba8a439167e7267b09af3551d3d41cd5dd59588 100644 (file)
@@ -321,6 +321,8 @@ PAG|{{ .Title }}|{{ $sect.InSection . }}
        rootPage := s.getPage(page.KindPage, "mypage.md")
        c.Assert(rootPage, qt.Not(qt.IsNil))
        c.Assert(rootPage.Parent().IsHome(), qt.Equals, true)
+       // https://github.com/gohugoio/hugo/issues/6365
+       c.Assert(rootPage.Sections(), qt.HasLen, 0)
 
        // Add a odd test for this as this looks a little bit off, but I'm not in the mood
        // to think too hard a out this right now. It works, but people will have to spell