Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

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)

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.


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 helper createPluginPaths
  • 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 during createSchemaCustomization and using the options.types created by createPluginOptions
  • Plugin creates the nodes during onCreateNode using the nodes created by gatsby-source-filesystem setup by createPluginPaths and the types configuration created by createPluginOptions
  • All the options and plugins can be configured manually if a more advanced naming of nodes and types is needed.
© 2023 Gatsby, Inc.