diff --git a/hugolib/pagecollections.go b/hugolib/pagecollections.go index 474b0a0b18a..0f73ebb0eae 100644 --- a/hugolib/pagecollections.go +++ b/hugolib/pagecollections.go @@ -126,7 +126,7 @@ func (c *pageFinder) getContentNode(context page.Page, isReflink bool, ref strin } if paths.HasExt(ref) { - return c.getContentNodeForRef(context, isReflink, inRef, ref) + return c.getContentNodeForRef(context, isReflink, true, inRef, ref) } var refs []string @@ -143,7 +143,7 @@ func (c *pageFinder) getContentNode(context page.Page, isReflink bool, ref strin } for _, ref := range refs { - n, err := c.getContentNodeForRef(context, isReflink, inRef, ref) + n, err := c.getContentNodeForRef(context, isReflink, false, inRef, ref) if n != nil || err != nil { return n, err } @@ -152,7 +152,7 @@ func (c *pageFinder) getContentNode(context page.Page, isReflink bool, ref strin return nil, nil } -func (c *pageFinder) getContentNodeForRef(context page.Page, isReflink bool, inRef, ref string) (contentNodeI, error) { +func (c *pageFinder) getContentNodeForRef(context page.Page, isReflink, hadExtension bool, inRef, ref string) (contentNodeI, error) { contentParser := c.pageMap.s.Conf.PathParser() if context != nil && !strings.HasPrefix(ref, "/") { @@ -163,7 +163,7 @@ func (c *pageFinder) getContentNodeForRef(context page.Page, isReflink bool, inR // Given the above, for regular pages we use the containing folder. var baseDir string if pi := context.PathInfo(); pi != nil { - if pi.IsBranchBundle() { + if hadExtension || pi.IsBranchBundle() { baseDir = pi.Dir() } else { baseDir = pi.ContainerDir()