2 minutes
Hugo Cloudinary Shortcode
The repo
What I wanted to achieve
I wanted to make it possible to produce Cloudinary image links by just giving the file name to a shortcode.
Setup
- make a submodule in your themes folder
- add the theme in the theme array in your
config.toml
- add the following to your params portion of
config.toml
Usage
The theme adds a shortcode called cl-image
. You can give following arguments
argument | description |
---|---|
src (required) | this is what is your image called on cloudinary. By default, it can be a gibberish so I advice you to change it to something memorable from the Cloudinary console. |
class | give a string of classes you wish to apply to the img element |
alt | same with the class |
style | same the class |
height | This is the pixel height of the image you give to the Cloudinary Transformation URL API. If your original image is too large, it is advised to reduce the size matching how large you are displaying on the website. |
width | same with the height |