Even though I have no references to .File.Path or .Path in my layouts I am getting:
Start building sites …
hugo v0.92.0-B3549403+extended linux/amd64 BuildDate=2022-01-12T08:23:18Z VendorInfo=gohugoio
WARN 2022/01/15 08:26:09 .File.Path on zero object. Wrap it in if or with: {{ with .File }}{{ .Path }}{{ end }}
By just scanning your example repo, I was unable to figure out why you get that error.
But it’s ok to not have index or _index for a section. The list.html layout (I saw that you have that) will take care of rendering the post section for you.
I had created this example repo yesterday and it generates the site alright even without index.md or _index.md.
@kaushalmodi I appreciate your thoughts, but apparently my description wasn’t clear enough: This WARN (non-fatal, the site still builds) is new and does not occur with older versions of Hugo. It’s not a build-breaker, just a warning, but it’s still not right, hence the post.
If you put an index.md or _index.md in the /content/post directory the WARN is no longer emitted. It’s also not a result of use of .File.Path, and therefore whatever the issue is, the error message is incorrect.
It could be related my repo being a Hugo module and yours not. I tested your repo in my environment it does not exhibit the issue, however your repo is also not a Hugo module and does not use Hugo modules.