Hi there, I really don’t understand this error message. Do I need to update my layout?
(ins)[hendry@t14s dabase.com]$ rg Path layouts/
layouts/partials/footer.html
3:{{ $editURL := printf "%s/edit/master/content/%s" "https://github.com/kaihendry/dabase.com" .Path }}
4:{{ $commitsURL := printf "%s/commits/master/content/%s" "https://github.com/kaihendry/dabase.com" .Path }}
(ins)[hendry@t14s dabase.com]$ hugo --panicOnWarning
Start building sites …
hugo v0.92.0+extended linux/amd64 BuildDate=unknown
WARN 2022/01/29 18:20:42 .Path when the page is backed by a file is deprecated and will be removed in a future release. We plan to use Path for a canonical source path and you probably want to check the source is a file. To get the current behaviour, you can use a construct simlar to the below:
{{ $path := "" }}
{{ with .File }}
{{ $path = .Path }}
{{ else }}
{{ $path = .Path }}
{{ end }}
^C
(ins)[hendry@t14s dabase.com]$ hugo version
hugo v0.92.0+extended linux/amd64 BuildDate=unknown
Could you please explain, how to make the message more obvious? We sometimes have issues having self-explanatory error messages, but to me, this looks quite such (self-explanatory):
Look for the .Path variable.
Replace with the code that is offered as a replacement.
Be happy it works again.
You have somewhere in your layout a range that goes over the page content and thepageyouareworkingwith.Path stopped existing. Because it is the same as .File.Path which that code sample would add or fall back gracefully if you are somewhere completely else.
If that still does not help you, please post the whole layout that throws the warning. But you will see that the end result is exactly the same Someone will replace your .Path with .File.Path.
And as I wrote above, if that error message is really so hard to understand for a non-developer (sorry if I sorted you into the wrong house here) please let us know how to do it better.
Your site should have been structured this way from the beginning, because it doesn’t make sense to offer edits to pages that are not backed by files. For example, going to https://dabase.com/tags/ and pressing the edit link currently throws a 404 error.