Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Need To Change Content Image src to data-src

  • #4327
    Avatar photo[anonymous]

    Is It Possible To Change Content Image src to data-src

    I want it to be changed only when synced to the server. If it’s just the rendering to view the site locally.. it would remain src.

    I am willing to pay for premium support but don’t where to subscribe for it.

    My site is all good n all but there are too many images. In WordPress, we can install the plugin and it rewrites the image URL. But things in HTML publii is complicated.

    Any support will be greatly appreciated.

    #4328
    Avatar photoBob

    Publii uses a new and modern native lazy loading mechanism to lazy-load images without the need to write custom lazy-loading code or use a separate JavaScript library. So you really do not need to change the src attribute. More about it: https://getpublii.com/dev/how-images-work-in-publii/#lazy-load

    PS: The premium support is dedicated only to the purchased products and does not include any custom work.

    #4331
    Avatar photo[anonymous]

    Thanks for your quick reply.

    I need data-src for CDN .. like Gumlet, Cloudinary, imagekit, cloudimage.io, etc.

    This important change is necessary to make these image CDNs to work.

    I have successfully changed the URLs for featured, avatar, logo, etc images. Just don’t know how to make changes for the content image.

    #4332
    Avatar photoBob

    Ah ok, so you need a custom helper to change the content images including gallery thumbnails.
    I attach such a file, just modify it to your needs. The unzipped file should be placed in the theme’s root folder ‎(Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME)

    helpers.js

    #4335
    Avatar photo[anonymous]

    Hi,

    Thanks for the help. Can you please help me with handlebar.js – I am good with PHP not with js – but really want to switch to static from wordpress.

    All I want is to change the:

    I don’t need any responsive image, lazyload, etc. These things are handled by the CDN.

    Please help me with this.

    Thanks!

    #4336
    Avatar photoBob

    If you need custom modifications or developer assistance you can use our paid service https://getpublii.com/customization-service/

    #4337
    Avatar photo[anonymous]

    Done! Please reply as soon as possible.