I am using “Html2React” to render post.content.
<Html2React html={post.content ? post.content : null} />
Is there a way to lazy load and add a placeholder to images present in “post.content” using image processor?
I am using “Html2React” to render post.content.
<Html2React html={post.content ? post.content : null} />
Is there a way to lazy load and add a placeholder to images present in “post.content” using image processor?
Hi @sarang, in order to achieve that you would need to write a “processor” which processes the images and adds placeholders
Frontity ships with a processor for images that lazy-loads the images for you. You can see how to add it to your frontity theme the way we did it in the mars-theme. However, this processor does not create the image placeholders for you (only does the lazy-loading) although placeholders are something that we’ve got on the roadmap.
The good news is that you could try to use the code for the current image processor and extend it to include a processor. If this is something that you’d need for your project then it would be awesome if you could add that feature as a PR to frontity so that other frontity users can also benefit from it :). I’d be really happy to help you out!
For reference, this is the original discussion about the feature: Image component: add support for placeholders