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

Untransformed images from assets directory not copying to public directory #5730

Closed
turijs opened this Issue Mar 2, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@turijs
Copy link

commented Mar 2, 2019

I am running into an issue where untransformed image resources from the assets folder are not being copied into the public directory (even though .Permalink is accessed) when a transformed version of them is created prior.

I have created a minimal project which (at least for me) demonstrates this issue on build: https://github.com/turijs/hugo-issue

This is what I am trying to do on the homepage:

<img src='{{ ((resources.Get "images/image1.jpg").Resize "500x").Permalink }}'>

{{ range readDir "./assets/images/" }}
<img src='{{ (resources.Get (printf "images/%s" .Name)).Permalink }}'>
{{ end }}

<img src='{{ ((resources.Get "images/image2.jpg").Resize "500x").Permalink }}'>

But the plain version of image1 does not make it to the public folder after running hugo.

public/images
├── image1_hu702e1bd1a84809a46dc9d0ff6c1dd170_246083_500x0_resize_q75_box.jpg
├── image2.jpg
└── image2_hu9edba475167d542bfd8aa8a2aa5d5bb1_89925_500x0_resize_q75_box.jpg
$ hugo version
Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown

I am running Mac OS 10.14.3.

Also wanted to add that I have found hugo to be an amazing tool so far. Thanks in advance for taking time to look into this!

@bep bep added the Bug label Mar 2, 2019

@bep bep added this to the v0.55 milestone Mar 2, 2019

@bep

This comment has been minimized.

Copy link
Member

commented Mar 2, 2019

Hey, and thanks for this. It is a curious bug. There seem to be some ordering/caching issue here, as if you change the order, it works as expected:

{{ define "main" }}

{{ range readDir "./assets/images/" }}
<img src='{{ (resources.Get (printf "images/%s" .Name)).Permalink }}'>
{{ end }}
<img src='{{ ((resources.Get "images/image1.jpg").Resize "500x").Permalink }}'>
<img src='{{ ((resources.Get "images/image2.jpg").Resize "500x").Permalink }}'>

{{ end }}

I will have a look at this later, and add a fix.

bep added a commit to bep/hugo that referenced this issue Mar 30, 2019

@bep bep closed this in #5801 Mar 30, 2019

bep added a commit that referenced this issue Mar 30, 2019

nguyenvanduocit added a commit to 12bitvn/hugo that referenced this issue Apr 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.