The Vimeo extension lets you fetch Vimeo videos and display them into a field in your content type. Subsequently, while creating entries, content managers can select only one of the listed videos at a time as the input value for that field, and the details of the video will be saved as JSON in Contentstack.
This step-by-step guide explains how to create a Vimeo custom field extension for your content types in Contentstack.
- Get the Vimeo Access token
- Add the Vimeo custom field extension to your stack
- Use your custom field
Get the Vimeo Access Token
In order to set up this extension, you will need your Vimeo account’s access token. Refer to this article to learn how to get it.
Note down the access token, as you will need it while configuring this extension in Contentstack ( in Step 3).
Add the Vimeo Custom Field Extension to Your Stack
- Go to your stack, navigate to the “Settings” gear icon, and select Extensions.
- On the Extensions page, click on the + Add Extension button, and select Create new. If you have not added any extensions in the stack yet, click on the create a new one link as shown below.
- In the Select Extension Type window, select Custom Field.
- On the Create New Extension page, enter values in the fields as given below:
- Title (required): Provide a suitable title, for example “Vimeo,” for your custom field. This title will be visible when you select the extension in the custom field in your content type.
- Field data type (required): Select the data type in which the input data of the field should be saved in Contentstack. In this case, select JSON.
- Multiple (optional): Leave this field unchecked.
- Hosting method (required): Select Hosted by Contentstack as the hosting method for this content type.
- Extension source code (required): Specify the extension code here. To get the code, contact our Support team.
The support team will provide you with the source code (src file). Copy the code from the index.html file located in the root folder and paste it in the Extension source code field.
- Config Parameter - Provide the value for the config parameter that is the Vimeo access token that you generated in step 1 as shown below:
Save the custom field.
Now, let’s understand how you can start using this custom field in your content type.
Use Your Custom Field
Once you have added a custom field, you can use it in your content type like any other field. To add a custom field in your content type, perform the following steps:
- Create a content type and add the Custom field to it.
- Under Select Extension, select the “Vimeo” field that you created and set the other properties. You can add other fields as per requirements.
- Finally, click on either Save or Save and Close to save your changes.
- Next, create an entry for this content type, and you will see the Vimeo field in action.
- Click Choose Video. This displays the list of the videos. Select the video you want to add and click on Save.
- Select the video you want to add and click on Save.