Skip to content
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

Bare data-* option #16

Open
mavaddat opened this issue Oct 27, 2021 · 1 comment
Open

Bare data-* option #16

mavaddat opened this issue Oct 27, 2021 · 1 comment

Comments

@mavaddat
Copy link
Owner

From jekyll-cloudinary created by jessecrouch: nhoizey#62

Is there a way to output only the src and srcset contents without the image tag?

Example:
I'm using jekyll-cloudinary together with lightGallery and some custom markup. In order to reference the image that lightGallery will use upon opening, I need to reference the image I would like to show in the data-src or data-srcset attribute. The image I reference is a different image than the one in the thumbnail (my thumbnail is a square version).

currently:

   <div class="Third" data-src="/images/tubing/2019/dz9.jpg">
      {% cloudinary landing_header_squares /images/tubing/2019/dz9-square.jpg class="img-responsive" %}
   </div>

I would like to provide a jekyll-cloudinary generated data-srcset version of that with an output like this:

   <div class="Third" data-srcset="http://res.cloudinary.com/<cloud_name>/tubing/2019/dz9.jpg-200-caa809.webp 200w, http://res.cloudinary.com/<cloud_name>tubing/2019/dz9.jpg-400-caa809.webp 400w">
      ...
   </div>

Is it possible to render only the data-srcset portion or another way of going about this? Any help appreciated, thanks!

@mavaddat
Copy link
Owner Author

Nice use case!

It is not currently possible directly, but you could develop a plugin to add a filter that would take jekyll-cloudinary output and keep only the content of the srcset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant