Open michaelmannucci opened 1 year ago
I feel like I experienced this issue as well. I'd try using your full project root src/img/hero.jpg
. I'm using this plugin extensively and this is how all my URLs are structured and it works fine.
As sygint mentioned you need to provide the image's full path as the src value's, in your case it needs to be:
But since you said it's not printing any errors and it outputs the same tag as in the source file I guess it's not being parsed correctly. Are you calling the eleventy-image tag in a .webc file? If not, you'll probably need to wrap the eleventy-image tag with the Render plugin: https://www.11ty.dev/docs/languages/webc/#use-the-render-plugin or change the htmlTemplateEngine to 'webc': https://www.11ty.dev/docs/languages/webc/#pre-process-html-input-as-webc.
full path worked for me. is there any way of setting it to relative paths?
full path worked for me. is there any way of setting it to relative paths?
I, too, woud love to use relative paths
Related: #208 adds support for relative paths in the Eleventy Transform. More to come here!
Agreed, it would be nice if the src
attribute could be specified relative to the input
directory so that renaming or moving the input
directory does not require editing all image tags. E.g. with input = src
,
<!-- Specify image src relative to the input directory -->
<img webc:is="eleventy-image" src="/img/something.jpg" ...>
I have followed the tutorial here, but it isn't doing anything at all. And no errors.
Here is my .eleventy.js:
Here is the tag I am using:
<eleventy-image src="hero.jpg" alt=""></eleventy-image>1
hero.jpg
exists at.src/img/hero.jpg
.Here is my package.json:
The site builds but puts nothing in
_site/img/
. Inspecting the HTML on my live site, it's outputting the tag exactly as I have it in src:<eleventy-image src="hero.jpg" alt=""></eleventy-image>
Any ideas what I am doing wrong?