Skip to content

Commit

Permalink
Include path to source page in non-relative ref/relref warning
Browse files Browse the repository at this point in the history
We occasionally see warnings when building our site:

```
WARN 2019/06/25 23:07:08 make non-relative ref/relref page reference(s) in page %q absolute, e.g. {{< ref "/blog/my-post.md" >}}
```

But the `%q` value is missing, making it difficult to track down the source of the warning.

This change addresses that, by including the source path in the warning:

```
WARN 2019/06/25 23:07:31 make non-relative ref/relref page reference(s) in page "blog/my-post/index.md" absolute, e.g. {{< ref "/blog/my-post.md" >}}
```
  • Loading branch information
justinvp authored and bep committed Jun 26, 2019
1 parent dc1d4a9 commit 59c4bc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hugolib/pagecollections.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (c *PageCollections) getPageNew(context page.Page, ref string) (page.Page,
if err == nil && p != nil {
if context != nil {
// TODO(bep) remove this case and the message below when the storm has passed
err := wrapErr(errors.New(`make non-relative ref/relref page reference(s) in page %q absolute, e.g. {{< ref "/blog/my-post.md" >}}`), context)
err := wrapErr(errors.Errorf(`make non-relative ref/relref page reference(s) in page %q absolute, e.g. {{< ref "/blog/my-post.md" >}}`, context.Path()), context)
helpers.DistinctWarnLog.Println(err)
}
return p, nil
Expand Down

0 comments on commit 59c4bc5

Please sign in to comment.