-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Images that were inserted via markdown are not lazyloaded #18
Comments
I kinda fixed it by modifying a <img{{ with $inClass }} class="{{ . }}"{{ end }}{{ with $loading }} loading="{{ . }}"{{ end -}} Removing of |
Another thing I noticed is that card title images (on the showcase list page, for example) are provided with a proper lqip images. It seems that the Doks theme has two separate image-handling routines, and that's why it has two similar sections in params.toml:
Is it true? |
Not sure what's causing the issue you're seeing. This looks OK to me: default Doks v0.5 deploy
Correct. It's a Doks history thing. Doks 1.0 will have a third (and only and better) way of doing images: gethyas/images. Doks 1.0 (including a migration path from 0.5) will be available soon. |
Thank you! I've checked and images in my blog posts get the proper treatment, just as in your default deploy. However, the docs section (i've modified it slightly, but certainly didn't touch markdown image processing!) doesn't apply data-src attribute to pictures. And, as I showed in the first post, getdoks.org docs page does not, too. Check the source of the page I mentioned. Maybe there are different rules regarding image processing for different sections? Or maybe blog images use one way you mentioned, and docs images use the other? Great to hear doks 1.0 is close to its release. Your theme inspired me to compose a personal site, so thanks a lot for all your efforts. Also, is there even a point in bothering with lazysides, if you can just use |
Thanks for your input! Get back to you next Wednesday (when I'm back home). |
Images 3.0 now is way more robust — and I dropped aFarkas/lazysizes support, for no longer really that relevant You should now see consistent and correct working behavior |
Thank you! I'm still on Doks 0.5 though, and I'd prefer not to update the main theme, because I've modified it a lot for my project, and I presume there would be a ton of compatibility issues if I'd update it. Is there an easy way to implement a new image module in Doks 0.5? Also, how do you handle LQIP now? Is it still some JS module? |
Upgrading to Doks v1 should not be that hard — also in your case. Here's the Upgrade to v1 guide if you'd like to give it a try. Looks like you could just upgrade easily — this should update @hyas/images from LQIP now is not that relevant anymore — so I dropped support for it. Read more on that here for example: Browser-level image lazy loading for the web |
Thanks, maybe in the future. I have a lot of custom scss, and also I've modified image handling in a last couple of months. I'm pretty happy with the way it is in my build now. Probably I'll start another project after I'll finish this one, and then I'll give the new doks version a try. It's interesting you've marked lqip as irrelevant; I thought it's generally a beneficial web design practice. |
Description
Although Doks docs page for images clearly states that images are lazyloaded, turned out they are not.
Steps to reproduce
One can see it by looking into the source code of the said docs page. The example of markdown-driven image with the following code...

...produces this line of HTML:
(I've deleted alt text for clarity)
However, srcset attribute doesn't work with lazysides module that handles lazyloading. It requires data-srcset attribute instead.
I've checked the loading of page sources. All 40 images from my test page loaded right away, without any "laziness".
Expected result
Lazyloading of the images
Actual result
Simultaneous loading of the images.
Environment
The text was updated successfully, but these errors were encountered: