Based on https://github.com/hennessyevan/netlify-cms-widget-youtube
As an npm package:
npm install --save netlify-cms-widget-youtube-expanded
import youtube from "netlify-cms-widget-youtube-expanded";
CMS.registerWidget("youtube", youtubeControl, youtubePreview);
Via script
tag:
<script src="https://unpkg.com/netlify-cms-widget-youtube@^0.3.0"></script>
<script>
CMS.registerWidget('youtube', youtubeControl, youtubePreview)
</script>
Add to your Netlify CMS configuration:
fields:
- { name: <fieldname>, label: <fieldlabel>, widget: youtube, extraInfo: false, APIkey: "<KEY>" }
Enabling extraInfo
will return an object in frontmatter
<fieldname>:
url: String
id: String
mediaType: String
imageURL: String
If you provide an API KEY in the configuration you will get additional information in the Control (as seen in the screenshot above). You can use this API key here to test but it's better you get your own to make sure it always works!
You need to add an API Key to the widget settings. Learn about getting an API Key here
You need to add extraInfo: true
to your Netlify CMS configuration (usually config.yml)
- Youtube Image in Preview
- Extended Details in Control from Youtube Data API
- Optional YAML object output
- Youtube Search function
- Couple with a Youtube "Editor Widget"
For help with this widget, open an issue or ask the Netlify CMS community in Gitter.