diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-01-05 12:56:41 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-01-05 19:41:53 +0100 |
commit | 196a9df585c4744e3280f37c1c24e469fce14b8c (patch) | |
tree | 30a3d06dec5846ad00c22fde5abe11269741511d /hugolib/pagecollections.go | |
parent | 9b6e61464b09ffe3423fb8d7c72bddb7a9ed5b98 (diff) |
hugolib: Fix relative .Page.GetPage from bundle
Fixes #6705
Diffstat (limited to 'hugolib/pagecollections.go')
-rw-r--r-- | hugolib/pagecollections.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/hugolib/pagecollections.go b/hugolib/pagecollections.go index 57878881a..023222bdd 100644 --- a/hugolib/pagecollections.go +++ b/hugolib/pagecollections.go @@ -267,7 +267,14 @@ func (c *PageCollections) getPageNew(context page.Page, ref string) (page.Page, } else if context != nil { // Try the page-relative path. - ppath := path.Join("/", strings.ToLower(context.SectionsPath()), ref) + var dir string + if !context.File().IsZero() { + dir = filepath.ToSlash(context.File().Dir()) + } else { + dir = context.SectionsPath() + } + ppath := path.Join("/", strings.ToLower(dir), ref) + p, err := c.getFromCache(ppath) if err == nil && p != nil { return p, nil |