hugolib: Only do page-relative getPage for relative paths
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 19 Jul 2018 15:47:05 +0000 (17:47 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 19 Jul 2018 15:47:05 +0000 (17:47 +0200)
Updates #4969

hugolib/page_collections.go

index e364d2ef25138495c8195ccd2362417fe37065c3..60f7dd83cf4cb70331897ce461b04b93cf8c2c11 100644 (file)
@@ -167,10 +167,8 @@ func (c *PageCollections) getPageNew(context *Page, ref string) (*Page, error) {
                if p, err := c.getFromCache(ref); err == nil && p != nil {
                        return p, nil
                }
-       }
-
-       // If there's a page context, try the page relative path.
-       if context != nil {
+       } else if context != nil {
+               // Try the page-relative path.
                ppath := path.Join("/", strings.Join(context.sections, "/"), ref)
                if p, err := c.getFromCache(ppath); err == nil && p != nil {
                        return p, nil