Configure your library
Set up and configure your media library
Once Media Library is enabled for your organization you can configure your CLI in order to create and deploy aspects.
This is a paid feature
This feature is available as an addon for certain Enterprise plans. Talk to sales to learn more.
Prerequisites:
npm
,pnpm
, or a similar package manager capable of installing and running thesanity
CLI.- Read/write access to your organization's Media Library.
Obtain your mediaLibraryId
When you interact with the sanity media
commands, you're prompted to select your library. If you only have a single organization, you should see a single library. If you're a member of multiple organizations, you can parse your organization and library ID using the URL.
Navigate to sanity.io/welcome, select your organization, then select the Media Library app. The URL for your library includes the mediaLibraryId.
https://www.sanity.io/@<organizationId>/media/<mediaLibraryId>/assets
Configure the CLI
Tell sanity
CLI where to define your aspects by updating sanity.cli.ts
.
import {defineCliConfig} from 'sanity/cli'
export default defineCliConfig({
api: {
projectId: '<projectId>',
dataset: '<dataset-name>'
},
mediaLibrary: {
// set the path relative to the location of sanity.cli.ts.
aspectsPath: 'aspects',
},
/**
* Enable auto-updates for studios.
* Learn more at https://www.sanity.io/docs/cli#auto-updates
*/
autoUpdates: true,
})
With the aspects path defined, you can now use the media
commands to create and deploy aspects.
Was this page helpful?