Hexo tag to add an image from Cloudinary - with srcset support
Install using npm.
npm install hexo-cloudinary --save
Install using yarn.
yarn add hexo-cloudinary
{% cloudinary src srcset [alt] [class] %}
where:
- src - path to image
- srcset - srcset sizes in following format
- small_width=small_cloudinary_transformation_id;big_width=big_cloudinary_transformation_id
- default false - no srcset
- alt - image title (optional)
- class - custom class (optional)
{% cloudinary http://res.cloudinary.com/USER_NAME/image/upload/IMAGE_NAME.png 320px=c_scale,q_auto:good,w_320;640px=c_scale,q_auto:good,w_640 "My image title" "my-image-class" %}
<img src="http://res.cloudinary.com/USER_NAME/image/upload/c_scale,q_auto:good,w_640/IMAGE_NAME.png" alt="My image title" srcset="http://res.cloudinary.com/USER_NAME/image/upload/c_scale,q_auto:good,w_320/IMAGE_NAME.png 320w, http://res.cloudinary.com/USER_NAME/image/upload/c_scale,q_auto:good,w_640/IMAGE_NAME.png 640w" sizes="(max-width:320px) 320px, 640px">
MIT