Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WARN .File.Dir on zero object. #728

Open
JOduMonT opened this issue Mar 30, 2020 · 6 comments
Open

WARN .File.Dir on zero object. #728

JOduMonT opened this issue Mar 30, 2020 · 6 comments
Assignees
Labels
Milestone

Comments

@JOduMonT
Copy link

JOduMonT commented Mar 30, 2020

What happened: this warning appear:
Building sites … WARN 2020/03/30 20:58:58 .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}

Hi I try to use Syna with Hugo
I had the error before the last version, and still have it with the last version of Syna and Hugo extended.

What you expected to happen:

  • Syna Theme version: version = "0.16.2"
  • Hugo version: Hugo Static Site Generator v0.68.3-157669A0/extended linux/amd64 BuildDate: 2020-03-24T12:13:38Z
  • Others: Ubuntu 18.04 with git version 2.17.1

How to reproduce it (as minimally and precisely as possible):

install hugo extended on Ubuntu

hugo new site site
cd site
git init
git add -A
git commit -m "hugo new site"
git submodule add https://git.okkur.org/syna themes/syna
cp -r themes/syna/exampleSite/* ./
sed -i /themesDir/d config.toml
hugo serve

or another way to reproduce it

git clone https://git.okkur.org/syna-start project-name && cd project-name
git submodule init
git submodule update
hugo serve

or this way

hugo new site site
cd site
git clone https://git.okkur.org/syna themes/syna
cd themes/syna/exampleSite
hugo serve
@stp-ip
Copy link
Member

stp-ip commented Mar 30, 2020

The error you mentioned is a warning and doesn't prevent anything from working.

Not sure, what specifically doesn't work. Just tested this with your reproduction steps and adding a new background image works and reloads.

What specific images aren't loading? Any code or config can share?

The linked issue was a specific windows issue and seems to be an unfortunate issue with Hugo itself.

@stp-ip stp-ip added this to the v0.17.0 milestone Mar 30, 2020
@JOduMonT
Copy link
Author

@stp-ip Yes; I realized that after, now the theme works fine and as you said it's only a warning.

However this warning seams to be wellknown from hugo community; not every theme have this error and some of them had it before and fixed it, but I'm unable to understand what they fixed. when I checked for .File.Dir in syna theme, it seams to be fine (from my non dev eye) maybe you will understand more than me

https://discourse.gohugo.io/t/error-what-to-replace-file-dir-with-in-hugo-book/18118

@JOduMonT JOduMonT changed the title WARN .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }} WARN .File.Dir on zero object. Mar 30, 2020
@mpourismaiel
Copy link
Member

This warning has cost us a lot of time to remove on each turn. We fix it and make sure it doesn't pop up and with no change, next update it appears again. And seriously it shouldn't appear as such a heart wrenching warning. It definitely is not a problematic issue, the if statement makes sure of that.

Still, we'll try and figure out what part is throwing the error and wait for the next update that makes it pop again.

Thanks for reporting it. If you find where the issue is, please let us know.

@stp-ip
Copy link
Member

stp-ip commented Apr 23, 2020

This should be fixed in the latest version v0.17.0.

Please reopen, if this comes up again.

@JOduMonT
Copy link
Author

FYI, with the version = "0.17.1" it's still there

Building sites … WARN 2020/05/26 13:36:43 .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}

@stp-ip stp-ip reopened this May 26, 2020
@stp-ip stp-ip modified the milestones: v0.17.0, v0.18.0 May 26, 2020
@stp-ip stp-ip self-assigned this May 26, 2020
@mpourismaiel
Copy link
Member

I cannot find the place that's causing the warning and lack the knowledge in Go to debug it from Hugo's side.

@stp-ip stp-ip modified the milestones: v0.17.3, v0.18.0 Jul 27, 2020
@stp-ip stp-ip modified the milestones: v0.17.4, v0.18.0 Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants