Skip to content

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

License

Notifications You must be signed in to change notification settings

marco-land/sanity-plugin-vimeo-field

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published