mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-24 02:51:04 +00:00
parent
e7d87e2410
commit
6792d86ad0
2 changed files with 5 additions and 0 deletions
|
@ -228,6 +228,7 @@ func (c *contentHandlers) parsePage(h contentHandler) contentHandler {
|
|||
if res.resource != nil {
|
||||
if pageResource, ok := res.resource.(*Page); ok {
|
||||
pageResource.resourcePath = filepath.ToSlash(childCtx.target)
|
||||
pageResource.parent = p
|
||||
}
|
||||
p.Resources = append(p.Resources, res.resource)
|
||||
}
|
||||
|
|
|
@ -132,6 +132,10 @@ func TestPageBundlerSiteRegular(t *testing.T) {
|
|||
assert.Contains(firstPage.Content, "TheContent")
|
||||
assert.Equal(6, len(leafBundle1.Resources))
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/4582
|
||||
assert.Equal(leafBundle1, firstPage.Parent())
|
||||
assert.Equal(leafBundle1, secondPage.Parent())
|
||||
|
||||
assert.Equal(firstPage, pageResources.GetByPrefix("1"))
|
||||
assert.Equal(secondPage, pageResources.GetByPrefix("2"))
|
||||
assert.Nil(pageResources.GetByPrefix("doesnotexist"))
|
||||
|
|
Loading…
Reference in a new issue