Browse your Sirv account and pick images, videos, 360 spins, views and 3D models directly inside DatoCMS. Assets stay on Sirv and are delivered from Sirv's global CDN with on-the-fly optimization - records store a small, portable JSON value.
@sirv/react package (responsive srcset,
lazy loading, sirv.js auto-load for spins/views/models).Credentials are stored in the plugin's global parameters, which are visible to project collaborators who can load the plugin (and to Content Management API tokens that can read plugins). Use a dedicated Sirv REST key for the project; keys can be revoked any time at my.sirv.com.
{ "_type": "sirvMedia", "mediaType": "image", "sirvPath": "/products/shoe.jpg", "sirvAlias": "youralias.sirv.com", "originalUrl": "https://youralias.sirv.com/products/shoe.jpg", "bytes": 123456, "width": 1600, "height": 1000, "alt": "Red running shoe", "caption": ""}The same flat shape is used by the Sirv plugins for Sanity, Storyblok, Contentful, Strapi and Payload - one frontend renderer works across all of them:
import { SirvMedia, fromSanityMedia as fromStoredMedia } from '@sirv/react';
<SirvMedia value={fromStoredMedia(JSON.parse(record.heroMedia))} width={640} />(DatoCMS returns JSON field values as strings in the GraphQL API - parse before rendering. See the example frontend.)