-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
First image return error "Missing alt
" while the next image succeeds with the same content
#153
Comments
Can you create a repository that reproduces this with bug with as less code as possible? Most bugs solve themselves when they're reproduceable |
@zeroby0 i tried to recreate the same workflow here https://github.com/adilsonfsantos/cautious-octo-carnival, if the repo i made still bloated please let me know so i can remove more things |
Using console.log to understand more i noticed that using four attributes (src, alt, classParent, classDescendent) bypass the "Missing `alt`" error as using only two (src, alt) makes the error return. // post.liquid
{% assign picture = image | prepend : "src" %}
{% images picture, "Alt text test", "post__splash--picture", "post__splash--image" %}
{% images picture, "Alt text test", "post__splash--picture", "post__splash--image" %} // Terminal output
{ src: 'src/assets/images/oscar-americano-wide.png' } { alt: 'post__splash--picture' } { classParent: undefined } { classDescendent: undefined } { sizes: '100vw' }
{ src: 'src/assets/images/oscar-americano-wide.png' } { alt: 'Alt text test' } { classParent: 'post__splash--picture' } { classDescendent: 'post__splash--image' } { sizes: '100vw' }
{ src: 'src/assets/images/fundacao-jornada-usuario-final.png' } { alt: 'Alt text test' } { classParent: 'post__splash--image' } { classDescendent: undefined } { sizes: '100vw' }
{ src: 'src/assets/images/fundacao-jornada-usuario-final.png' } { alt: 'Alt text test' } { classParent: 'post__splash--picture' } { classDescendent: 'post__splash--image' } { sizes: '100vw' } Two attributes // post.liquid
{% assign picture = image | prepend : "src" %}
{% images picture, "Alt text test" %}
{% images picture, "Alt text test" %} // Terminal output
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble writing template: "./dist/projetos/fundacao/index.html" (via EleventyTemplateError)
[11ty] 2. Missing `alt` on responsiveimage from: src/assets/images/oscar-americano-wide.png, file:./src/_includes/layouts/post.liquid, line:19, col:7 (via RenderError)
[11ty] 3. Missing `alt` on responsiveimage from: src/assets/images/oscar-americano-wide.png (via Error)
[11ty]
[11ty] Original error stack trace: Error: Missing `alt` on responsiveimage from: src/assets/images/oscar-americano-wide.png
[11ty] at Object.imageShortcode (/home/adilson/Dev/eleventy-test/.eleventy.js:12:11)
[11ty] at Object.<anonymous> (/home/adilson/Dev/eleventy-test/node_modules/@11ty/eleventy/src/BenchmarkGroup.js:32:26)
[11ty] at Object.render (/home/adilson/Dev/eleventy-test/node_modules/@11ty/eleventy/src/Engines/Liquid.js:153:25)
[11ty] at async TemplateLayout.render (/home/adilson/Dev/eleventy-test/node_modules/@11ty/eleventy/src/TemplateLayout.js:161:25)
[11ty] at async Template.renderPageEntry (/home/adilson/Dev/eleventy-test/node_modules/@11ty/eleventy/src/Template.js:853:17)
[11ty] at async /home/adilson/Dev/eleventy-test/node_modules/@11ty/eleventy/src/Template.js:883:21
[11ty] at async Promise.all (index 0)
[11ty] at async Promise.all (index 4)
[11ty] at async Eleventy.executeBuild (/home/adilson/Dev/eleventy-test/node_modules/@11ty/eleventy/src/Eleventy.js:1003:13)
[11ty] at async Eleventy.watch (/home/adilson/Dev/eleventy-test/node_modules/@11ty/eleventy/src/Eleventy.js:846:18) Also using |
FixedThe problem was on 11ty side no the image plugin, the undefined error was fixed in 11ty/eleventy#2367, which is available on https://github.com/11ty/eleventy/releases/tag/v2.0.0-canary.9 and higher or in a future v1.0.2 of 11ty. I'll keep the https://github.com/adilsonfsantos/cautious-octo-carnival open so if anyone have this problem can check the fix package.json "@11ty/eleventy": "^2.0.0-canary.9" |
Hello everybody, in first place thanks for the plugin.
While trying to implement eleventy-img in my post.liquid layout, 11ty return the "Missing `alt` " error:
post.liquid
eleventy.js
So to test further i disabled the
if(alt === undefined)
from eleventy.js and by trying with the same content the results are fine for the second image but the first stiil have the same errorpost.liquid
Result
Terminal output with Debug Mode
Is this a bug or am i forgetting something?
System information:
The text was updated successfully, but these errors were encountered: