gastby-source-netlify-cms (Beta)
gatsby-config.js
setting up your Default setup uses the helper functions imported from the plugin.
const config = ; // netlify-cms config file (json format required)const createPluginPaths createPluginOptions = ; moduleexports = plugins: resolve: "gatsby-source-netlify-cms" options: ...
Note: The options.types
of this plugin must match the options.name
targets of the plugin paths being setup for the gatsby-source-filesystem
plugin. If you plan to set these up manually, make sure to adhere to this naming convention or this plugin will ignore the nodes during onCreateNode
.
Information
This configuration and plugin is going to do the following:
- Create a valid options object for the source plugin using helper
createPluginOptions
- Sets up the
gatsby-source-filesystem
plugins to the paths of collections using helpercreatePluginPaths
- Plugin will resolve the paths for the cms using the config during
onPreBootstrap
. If they don't exist, the plugin will create them. - Plugin creates the schema from the config using Gatsby's
actions.createTypes
duringcreateSchemaCustomization
and using theoptions.types
created bycreatePluginOptions
- Plugin creates the nodes during
onCreateNode
using the nodes created bygatsby-source-filesystem
setup bycreatePluginPaths
and the types configuration created bycreatePluginOptions
- All the options and plugins can be configured manually if a more advanced naming of nodes and types is needed.