Getting Started with CldOgImage
The CldOgImage component provides an easy way to deliver images from Cloudinary in an Astro app.
With it comes access to more advanced features like dynamic cropping, background removal, overlays, and other Cloudinary transformations.
As CldImage is a wrapper around the Unpic Image component, you also gain access to built-in Image component features that will work out-of-the-box like Responsive Sizing.
Basic Usage
The basic required props include twitterTitle
, src
, and alt
:
CldOgImage does not render an
<img>
tag, meaning it can’t be visually embedded on a page. The following examples make use of the<CldImage>
tag to showcase what’s possible.
The resulting HTML will be applied to the Head of the document including all applicable open graph tags:
The src
property takes in a Cloudinary Public ID which includes the folder path along with the ID of the image itself.
The twitterTitle
should represent the title of the page and the alt
value should be a text-based description
of the image.
Additional Features
You can further take advantage of Cloudinary features like replacing backgrounds with generative AI and text overlays by adding additional props:
Check out more examples of what you can do with transformations in the CldImage docs because the CldOgImage supports all the params that the CldImage component does!