Retrieve Vimeo video data via the API with an access token and store it in Sanity.
yarn install sanity-plugin-vimeo-field
# or npm
npm install sanity-plugin-vimeo-fieldℹ This is a Sanity Studio v3 plugin
Add your Vimeo access token to your .env
SANITY_STUDIO_VIMEO_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"Add the plugin to your Sanity configuration
// `sanity.config.ts` / `sanity.config.js`:
import {defineConfig} from 'sanity'
import {vimeoField} from 'sanity-plugin-vimeo-field'
export default defineConfig({
// ...
plugins: [
// ...
vimeoField({
accessToken: process.env.SANITY_STUDIO_VIMEO_ACCESS_TOKEN,
}),
],
})// … your schema
defineField({
title: 'Vimeo',
name: 'vimeo',
type: 'vimeo',
// Optional: Extend the default fields, see below for more information
options: {
fields: ['metadata'],
},
})By default the plugin stores the fields name, pictures, files and play, but you can extend (not overwrite) the fields through the options. Please be sure to add fields as an array of strings. See the vimeo response documentation for a list of available fields.
MIT © Marco Land
This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.
See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.
