Skip to content
Branch: master
Find file History
sidharthachatterjee chore(release): Publish
 - babel-plugin-remove-graphql-queries@2.7.15
 - babel-preset-gatsby-package@0.2.10
 - babel-preset-gatsby@0.2.21
 - gatsby-cli@2.8.9
 - gatsby-codemods@1.1.14
 - gatsby-core-utils@1.0.18
 - gatsby-cypress@0.2.15
 - gatsby-dev-cli@2.5.37
 - gatsby-graphiql-explorer@0.2.27
 - gatsby-image@2.2.31
 - gatsby-link@2.2.23
 - gatsby-page-utils@0.0.29
 - gatsby-plugin-canonical-urls@2.1.14
 - gatsby-plugin-catch-links@2.1.16
 - gatsby-plugin-coffeescript@2.1.14
 - gatsby-plugin-create-client-paths@2.1.16
 - gatsby-plugin-cxs@2.1.12
 - gatsby-plugin-emotion@4.1.14
 - gatsby-plugin-facebook-analytics@2.2.15
 - gatsby-plugin-feed@2.3.20
 - gatsby-plugin-flow@1.1.13
 - gatsby-plugin-fullstory@2.1.15
 - gatsby-plugin-glamor@2.1.14
 - gatsby-plugin-google-analytics@2.1.25
 - gatsby-plugin-google-gtag@1.1.15
 - gatsby-plugin-google-tagmanager@2.1.16
 - gatsby-plugin-guess-js@1.1.23
 - gatsby-plugin-jss@2.1.13
 - gatsby-plugin-layout@1.1.14
 - gatsby-plugin-less@3.0.13
 - gatsby-plugin-lodash@3.1.14
 - gatsby-plugin-manifest@2.2.27
 - gatsby-plugin-mdx@1.0.56
 - gatsby-plugin-netlify-cms@4.1.27
 - gatsby-plugin-netlify@2.1.24
 - gatsby-plugin-nprogress@2.1.13
 - gatsby-plugin-offline@3.0.19
 - gatsby-plugin-page-creator@2.1.29
 - gatsby-plugin-postcss@2.1.14
 - gatsby-plugin-preact@3.1.20
 - gatsby-plugin-preload-fonts@1.0.16
 - gatsby-plugin-react-css-modules@2.1.14
 - gatsby-plugin-react-helmet@3.1.14
 - gatsby-plugin-remove-trailing-slashes@2.1.13
 - gatsby-plugin-sass@2.1.21
 - gatsby-plugin-sharp@2.2.37
 - gatsby-plugin-sitemap@2.2.20
 - gatsby-plugin-styled-components@3.1.12
 - gatsby-plugin-styled-jsx@3.1.13
 - gatsby-plugin-styletron@4.1.18
 - gatsby-plugin-stylus@2.1.15
 - gatsby-plugin-subfont@1.1.15
 - gatsby-plugin-twitter@2.1.13
 - gatsby-plugin-typescript@2.1.16
 - gatsby-plugin-typography@2.3.16
 - gatsby-react-router-scroll@2.1.15
 - gatsby-remark-autolink-headers@2.1.17
 - gatsby-remark-code-repls@3.0.17
 - gatsby-remark-copy-linked-files@2.1.29
 - gatsby-remark-custom-blocks@2.1.17
 - gatsby-remark-embed-snippet@4.1.14
 - gatsby-remark-graphviz@1.1.16
 - gatsby-remark-images-contentful@2.1.22
 - gatsby-remark-images@3.1.30
 - gatsby-remark-katex@3.1.16
 - gatsby-remark-prismjs@3.3.22
 - gatsby-remark-responsive-iframe@2.2.26
 - gatsby-remark-smartypants@2.1.15
 - gatsby-source-contentful@2.1.56
 - gatsby-source-drupal@3.3.4
 - gatsby-source-faker@2.1.13
 - gatsby-source-filesystem@2.1.36
 - gatsby-source-graphql@2.1.22
 - gatsby-source-hacker-news@2.1.15
 - gatsby-source-lever@2.1.18
 - gatsby-source-medium@2.1.13
 - gatsby-source-mongodb@2.1.21
 - gatsby-source-npm-package-search@2.1.17
 - gatsby-source-shopify@3.0.27
 - gatsby-source-wikipedia@2.1.13
 - gatsby-source-wordpress@3.1.47
 - gatsby-telemetry@1.1.36
 - gatsby-theme-blog-core@1.0.17
 - gatsby-theme-blog@1.1.17
 - gatsby-theme-notes@1.0.16
 - gatsby-theme-workspace@1.0.4
 - gatsby-transformer-asciidoc@1.1.16
 - gatsby-transformer-csv@2.1.17
 - gatsby-transformer-documentationjs@4.1.17
 - gatsby-transformer-excel@2.2.15
 - gatsby-transformer-hjson@2.2.19
 - gatsby-transformer-javascript-frontmatter@2.1.18
 - gatsby-transformer-javascript-static-exports@2.2.18
 - gatsby-transformer-json@2.2.17
 - gatsby-transformer-pdf@1.1.18
 - gatsby-transformer-react-docgen@5.0.20
 - gatsby-transformer-remark@2.6.33
 - gatsby-transformer-screenshot@2.1.39
 - gatsby-transformer-sharp@2.3.3
 - gatsby-transformer-sqip@2.1.41
 - gatsby-transformer-toml@2.2.17
 - gatsby-transformer-xml@2.1.18
 - gatsby-transformer-yaml@2.2.16
 - gatsby@2.17.11
 - graphql-skip-limit@2.1.19
Latest commit 0efca77 Nov 10, 2019

README.md

gatsby-plugin-netlify-cms

Gatsby v1 and Netlify CMS 1.x require gatsby-plugin-netlify-cms@^2.0.0.

Gatsby v2 and Netlify CMS 2.x require gatsby-plugin-netlify-cms@^3.0.0.

Gatsby v2 and Netlify CMS (netlify-cms-app) 2.9.x required gatsby-plugin-netlify-cms@^4.0.0, which is documented below.

Overview

Automatically generates an admin/index.html with a default Netlify CMS implementation.

Netlify CMS is a React single page app for editing git based content via API. Its built for non-technical and technical editors alike, and its super easy to install and configure. For more details, check out the docs site.

Note: gatsby-plugin-netlify-cms@^4.0.0 changes the requirement for Netlify CMS to use a new library published netlify-cms-app@^2.9.x and is a breaking change.

Install

npm install --save netlify-cms-app gatsby-plugin-netlify-cms

How to use

Add the Netlify CMS plugin in your gatsby-config.js:

plugins: [`gatsby-plugin-netlify-cms`]

Then add your Netlify CMS configuration file in static/admin/config.yml.

Options

Netlify CMS can be configured via the plugin options below. You can learn about how to pass options to plugins in the Gatsby docs.

modulePath

(optional, type: string | Array<string>, default: undefined)

If you need to customize Netlify CMS, e.g. registering custom widgets or styling the preview pane, you'll need to do so in a JavaScript module and provide Gatsby with the path to your module via the modulePath option. Any styles imported by this module (or by the modules that it imports, all the way down the chain) are automatically applied to the editor preview pane by the plugin.

plugins: [
  {
    resolve: `gatsby-plugin-netlify-cms`,
    options: {
      /**
       * One convention is to place your Netlify CMS customization code in a
       * `src/cms` directory.
       */
      modulePath: `${__dirname}/src/cms/cms.js`,
    },
  },
]

The js module might look like this:

/**
 * The default export of `netlify-cms-app` is an object with all of the Netlify CMS
 * extension registration methods, such as `registerWidget` and
 * `registerPreviewTemplate`.
 */
import CMS from "netlify-cms-app"

/**
 * Any imported styles will automatically be applied to the editor preview
 * pane, there is no need to use `registerPreviewStyle` for imported styles.
 * All of the example imports below would result in styles being applied to the
 * preview pane.
 */
import "module-that-imports-styles.js"
import "styles.scss"
import "../other-styles.css"

/**
 * Let's say you've created widget and preview components for a custom image
 * gallery widget in separate files:
 */
import ImageGalleryWidget from "./image-gallery-widget.js"
import ImageGalleryPreview from "./image-gallery-preview.js"

/**
 * Register the imported widget:
 */
CMS.registerWidget(`image-gallery`, ImageGalleryWidget, ImageGalleryPreview)

manualInit

(optional, type: boolean, default: false)

Set this to true If you need to manually initialize Netlify CMS. The plugin will take care of setting window.CMS_MANUAL_INIT to true:

plugins: [
  {
    resolve: `gatsby-plugin-netlify-cms`,
    options: {
      manualInit: true,
    },
  },
]

The js module might look like this:

import CMS from "netlify-cms-app"

/**
 * Optionally pass in a config object. This object will be merged into `config.yml` if it exists
 */

CMS.init({
  config: {
    backend: {
      name: "git-gateway",
    },
  },
})

enableIdentityWidget

(optional, type: boolean, default: true)

enableIdentityWidget is true by default, allowing Netlify Identity to be used without configuration, but you may need to disable it in some cases, such as when using a Netlify CMS backend that conflicts. This is currently known to be the case when using the GitLab backend, but only when using implicit OAuth.

plugins: [
  {
    resolve: `gatsby-plugin-netlify-cms`,
    options: {
      enableIdentityWidget: true,
    },
  },
]

publicPath

(optional, type: string, default: "admin")

Customize the path to Netlify CMS on your Gatsby site.

htmlTitle

(optional, type: string, default: Content Manager)

Customize the value of the title tag in your CMS HTML (shows in the browser bar).

htmlFavicon

(optional, type: string, default: "")

Customize the value of the favicon tag in your CMS HTML (shows in the browser bar).

includeRobots

(optional, type: boolean, default: false)

By default, the CMS page is not indexed by crawlers. Use this to add a meta tag to invite robots to index the CMS page.

customizeWebpackConfig

(optional, type: function)

Function to customize webpack configuration.

Function parameters:

plugins: [
  {
    resolve: `gatsby-plugin-netlify-cms`,
    options: {
      customizeWebpackConfig: (config, { plugins }) => {
        const Plugin = require("...")

        config.plugins.push(
          plugins.define({
            "process.env.MY_VAR": JSON.stringify("my var value"),
          })
        )

        config.plugins.push(new Plugin())
      },
    },
  },
]

Example

Here is the plugin with example values for all options (note that no option is required):

plugins: [
  {
    resolve: `gatsby-plugin-netlify-cms`,
    options: {
      modulePath: `path/to/custom/script.js`, // default: undefined
      enableIdentityWidget: true,
      publicPath: `admin`,
      htmlTitle: `Content Manager`,
      htmlFavicon: `path/to/favicon`,
      includeRobots: false,
    },
  },
]

Support

For help with integrating Netlify CMS with Gatsby, check out the community Gitter.

You can’t perform that action at this time.