hugolib: Fix relative .Page.GetPage from bundle

Fixes #6705
This commit is contained in:
Bjørn Erik Pedersen
2020-01-05 12:56:41 +01:00
parent 9b6e61464b
commit 196a9df585
4 changed files with 51 additions and 3 deletions

View File

@@ -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