Unstack Dev Docs
Search…
Media Instance
The Media Instance tag allows you to create instances of media attached to a given object type. This is currently used only within the context of the Articles generator, for referencing the featured image media for each article in the generator.
1
{{ media_instance(element, src, [className, alt, aspectRatio, crop, quality]) }}
Copied!

Media Instance Tag Arguments:

  • element: DataLocator - the data-element storing the Media Instance's configuration
  • className: string (optional) - a hard-coded class name to add to the rendered element
  • src: DataLocator (optional) - a reference to the src locator for this media in the data
  • alt: DataLocator (optional) - a reference to the alt locator for this media in the data
  • aspectRatio: number (optional) - an expression indicating the desired proportions of the resized media instance on output, e.g. "1x1", "4x3" or "16x9". (Default: none)
  • crop: string (optional) - an expression indicating the desired cropping of the resized media instance on output, e.g. "topleft", "topcenter', or "middlecenter" (Default: none)
  • quality: number (optional) - a number from 1-100 indicating the compression quality of the media for output formats that support it (default 80)
Last modified 1mo ago