Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 1.79 KB

README.md

File metadata and controls

72 lines (52 loc) · 1.79 KB

Sanity Plugin Vimeo Field

Retrieve Vimeo video data via the API with an access token and store it in Sanity.

Sanity Plugin Vimeo Field Preview

Installation

yarn install sanity-plugin-vimeo-field
# or npm
npm install sanity-plugin-vimeo-field

ℹ This is a Sanity Studio v3 plugin

Configuration

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,
    }),
  ],
})

Usage

// … your schema
defineField({
  title: 'Vimeo',
  name: 'vimeo',
  type: 'vimeo',
  // Optional: Extend the default fields, see below for more information
  options: {
    fields: ['metadata'],
  },
})

Options

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.

License

MIT © Marco Land

Develop & test

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.