Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-20 00:02:33 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-21 12:42:07 +0300
commita451c49fde1da6e2cc436a2b7d383ee772b1f893 (patch)
tree4243ace8f79d5f83642428d3336971b5f56de672 /hugolib
parentff16c42ed0965e1c8acf6e6a6dcda3ea50c107f2 (diff)
hugolib: Print a WARNING about relative non-relative ref/relref matches
Fixes #4973
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/page_collections.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/hugolib/page_collections.go b/hugolib/page_collections.go
index 41c88cd62..d196d67a3 100644
--- a/hugolib/page_collections.go
+++ b/hugolib/page_collections.go
@@ -20,6 +20,7 @@ import (
"strings"
"github.com/gohugoio/hugo/cache"
+ "github.com/gohugoio/hugo/helpers"
)
// PageCollections contains the page collections for a site.
@@ -215,6 +216,10 @@ func (c *PageCollections) getPageNew(context *Page, ref string) (*Page, error) {
if !strings.HasPrefix(ref, "/") {
// Many people will have "post/foo.md" in their content files.
if p, err := c.getFromCache("/" + ref); err == nil && p != nil {
+ if context != nil {
+ // TODO(bep) remove this case and the message below when the storm has passed
+ helpers.DistinctFeedbackLog.Printf(`WARNING: make non-relative ref/relref page reference(s) in page %q absolute, e.g. {{< ref "/blog/my-post.md" >}}`, context.absoluteSourceRef())
+ }
return p, nil
}
}
@@ -225,7 +230,7 @@ func (c *PageCollections) getPageNew(context *Page, ref string) (*Page, error) {
if err != nil {
if context != nil {
- return nil, fmt.Errorf("failed to resolve page relative to page %q: %s", context.absoluteSourceRef(), err)
+ return nil, fmt.Errorf("failed to resolve path from page %q: %s", context.absoluteSourceRef(), err)
}
return nil, fmt.Errorf("failed to resolve page: %s", err)
}