gatsby-source-netlify-cms
v0.10.5
Published
#### setting up your `gatsby-config.js`
Downloads
79
Readme
gastby-source-netlify-cms (Beta)
setting up your gatsby-config.js
Default setup uses the helper functions imported from the plugin.
const config = require(`config.json`); // netlify-cms config file (json format required)
const { createPluginPaths, createPluginOptions } = require('gatsby-source-netlify-cms');
module.exports = {
plugins: [
{
resolve: "gatsby-source-netlify-cms",
options: createPluginOptions(config)
},
...createPluginPaths(config),
]
}
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.