Middleman Responsive Images

How I can generate srcset for images? Tried a lot of options for image url … but i can’t get it work. Its loading just one image.

example

img data-srcset="#{post.image.url(w: 1024, fit:‘max’, auto:‘format’)}" data-src="#{post.image.url(w: 400, auto:‘format’)}" data-sizes="(min-width: 36em) 33.3vw,100vw" class=“lazyload” alt="#{post.image.alt}"

Hey @milemodic welcome! :slight_smile:

Unfortunately we don’t provide that functionality on the REST API (which is the one used by the Ruby client).

So if you want to get the srcset, you should build it yourself by getting all the different URLs that you want.

Alternatively you should use the GraphQL API, which provides that automatically: https://www.datocms.com/docs/content-delivery-api/images-and-videos#responsive-images

Hope this clarifies, otherwise let me know!