Error calling Path

Upon running

hugo --panicOnWarning

I get:

.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 similar to the one below:

{{ $path := “” }}
{{ with .File }}
{{ $path = .Path }}
{{ else }}
{{ $path = .Path }}
{{ end }}

Error: Error building site: failed to render pages: render of “page” failed: execute of template failed: template: publication/single.html:4:3: executing “publication/single.html” at <partial “site_head.html” .>: error calling partial: “xxxx/themes/academic/layouts/partials/site_head.html:17:51”: execute of template failed: template: partials/site_head.html:17:51: executing “partials/site_head.html” at <.Path>: error calling Path: Warning trapped. Remove the --panicOnWarning flag to continue.

How do I fix that?

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.