🧝in 1.9.2-alpha

Filters

Filters take in a value, do something to it, and return it. They’re especially useful because they can be strung together to run several operations on a value in sequence.

This plugin is primarily intended for use with nunjucks (or .njk) templates. The filters are defined as universal, and should work in Liquid and 11ty.js templates, but haven’t been tested.

url

The url filter behaves essentially the same as the shortcode, except that it takes its parameters a bit differently:

{{ 'image.jpg' | img([{ width: 470 }]) }}

extract

This will attempt to pull out various pieces of Cloudinary-specific data from the value it is given–typically a Cloudinary URL of some type. The usefulness of this filter is probably limited: The only time you might want to use it is if for some reason you are manually constructing a Cloudinary URL instead of using the plugin’s shortcodes or filters.

It accepts a single additional argument, which is a string describing the “part” you wish to extract. If it does not recognize the string, or you don’t pass it one, it will default to returning the public ID.

The public ID will always be returned; the other parts are only available if they exist. They will be null otherwise.

Available parts:

---
image:'https://res.cloudinary.com/cloud-name/image/upload/v1612446409/photo.png'
---


{{ image | extract('id') }}
<!-- 'photo' -->

{{ image | extract('cloud') }}
<!-- 'cloud-name' -->

{{ image | extract('version') }}
<!-- '1612446409' -->