-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
Image appears in serve, not displayed in build? #197
Comments
Here are a couple ideas to help (which helped me with my website):
|
Sorry it has been so long - I've had weeks of serious problems with my off-grid home power system... I've figured out why the images don't appear. I run my own server, and want to continue serving the old site to the public while I test the new eleventy version. I tried to set the base of the eleventy site to If I manually type in the /11 version of the URL, all of the site elements, including the images, are available there. But the internal links do not include the /11 and either fail or go to the old site. Is there some way to tell Eleventy to base all of the site in that /11 folder? |
You could use pathPrefix, which allows you to deploy to a subdirectory (/11 in your case). I haven't used it, but it looks like it would fit your needs. |
I've added an image to the top of my landing page:
eleventy-base-blog/content/index.njk
The image is in:
eleventy-base-blog/content/Psyicon.jpg
It works in the serve view (browser inspect):
<picture><source type="image/avif" srcset="/.11ty/image/?src=content%2FPsyicon.jpg&width=500&format=avif&via=transform 500w"><source type="image/webp" srcset="/.11ty/image/?src=content%2FPsyicon.jpg&width=500&format=webp&via=transform 500w"><img loading="lazy" decoding="async" src="/.11ty/image/?src=content%2FPsyicon.jpg&width=500&format=jpeg&via=transform" alt="Icon made of four arcs curving in from the the sides of the image, symbolizing my struggle to connect peripheral space to my shattered central view." class="center" width="500" height="500"></picture>
When I build the same project, the image shows the tiny not found icon, and the Alt text is shown following it:
<picture><source type="image/avif" srcset="/aRCUHcwHWl-500.avif 500w"><source type="image/webp" srcset="/aRCUHcwHWl-500.webp 500w"><img loading="lazy" decoding="async" src="/aRCUHcwHWl-500.jpeg" alt="Icon made of four arcs curving in from the the sides of the image, symbolizing my struggle to connect peripheral space to my shattered central view." class="center" width="500" height="500"></picture>
The build version has no Psyicon.jpg, but has 3 versions of
eleventy-base-blog/_site/aRCUHcwHWl-500.jpeg/avif/webp
It is quite possible I've done something newbie stupid, but shouldn't the serve view and the built site agree on whether ir works or not?
Also, the three build versions of the image are tiny files and noticeably fuzzier than the original. Is there some way to avoid that transformation?
And... The image in the serve version is not centered, despite the class="center" option. Does that not work here?
Clues appreciated!
The text was updated successfully, but these errors were encountered: