Skip to content
This repository was archived by the owner on May 19, 2023. It is now read-only.

maliMirkec/hexo-cloudinary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexo-cloudinary NPM version

Hexo tag to add an image from Cloudinary - with srcset support

Install

Install using npm.

npm install hexo-cloudinary --save

Install using yarn.

yarn add hexo-cloudinary

Usage

{% 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)

Example

{% 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">

License

MIT

NPM downloads

About

Hexo tag to add images from Cloudinary

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •