-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-images] [gatsby-remark-images] Customizing html of a markdown to implement lazy-loading #2288
Comments
Have you looked at gatsby-remark-images ? |
I've always intended gatsby-remark-images to support lazy loading but haven't gotten there quite yet. Now that I've been exploring this more with https://using-gatsby-image.gatsbyjs.org/, I'd love to make it happen. |
@KyleAMathews |
@roberpoldo I believe it will be transparent, |
@roberpoldo the two are mostly unrelated. So for markdown images, someone just needs to add support to gatsby-remark-images for lazy-loading. For |
@KyleAMathews I'm now using |
More precision: the |
There's new versions which fix that. |
@KyleAMathews Thanks for this new version! Is there any -webkit fix to make |
You'll need to add a polyfill for the IntersectionObserver API. I haven't investigated this closely so can't offer much help there but would love to hear back from your research. |
|
Anyone has an idea how to disable the blur effect option (base64) in the html markdown graphql query with
|
@KyleAMathews I might be that someone 😍 – I'd love to have lazy loading gatsby-remark-images. I however fear that integrating gatsby-image like @sebastienfi wrote earlier
might be a little over my head? I probably need some guidance/hint on how to approach this (as usual ;-D)… |
Going through old issues I didn't respond to 😅 So unfortunately we can't use gatsby-image for this as What we'll want to do instead is to add some JS to the Hope that helps! Happy to clarify things more. |
Maybe... but we'd need a gatsby-remark-image-component or something like that to change from adding |
Went ahead and hacked lazy-loading into my blog and it seems to work okay (example page), though it's quite a bit less graceful than what you'd get from |
If anyone else comes across this issue – this is how I solved it! I created a local plugin that is a simplified version of Then you can use This would probably work nicer with |
@alexandernanberg Thanks for sharing your approach. I was just wondering if MDX would in that case be a bit simpler to set this up. Going down the rabbit hole :) |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
Hi, I came across this issue and checked both solutions by @alexandernanberg and @thomasboyt. My solution takes hints from both of you. Let me share it! I created a npm package gatsby-remark-lazy-load. This converts Then, you load That's it! I'm not fully happy about the solution, but it does what I want to achieve. So, I am okay with this solution right now. You can find my repo here. Let me know if you have any suggestions! |
I would like to customize the html of a Markdown Post to implement lazy-loading. I need to add a class to the images and change the "src" attribute to "data-src". I have tried directly in the markdown file
<img class="lazyload" data-src="…"/>
but it didn't work. Anyone has an idea how to make it? Thanks!The text was updated successfully, but these errors were encountered: