7.12.1 • Published 1 year ago

gatsby-plugin-netlify-cms v7.12.1

Weekly downloads
24,537
License
MIT
Repository
github
Last release
1 year ago

⚠️ This package is now deprecated

The gatsby-plugin-netlify-cms package is now deprecated. This plugin has been renamed and moved to Decap CMS. See gatsby-plugin-decap-cms for more information.

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 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 should be automatically be applied to the editor preview
 * pane thus eliminating the need to use `registerPreviewStyle` for imported
 * styles. However if you are experiencing build errors regarding importing css,
 * sass or scss into a cms module when deploying to the netlify platform, you
 * may need to follow the implementation found in netlify documentation here:
 * https://www.netlifycms.org/docs/beta-features/#raw-css-in-registerpreviewstyle
 * 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. Disable it when not using Netlify Identity to reduce bundle size.

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,
    },
  },
]

Disable widget on site

If you're not using Netlify Identity within your site you have the option to completely disable the widget (and not the CMS). To do so, add the following to gatsby-node.js:

const webpack = require(`webpack`)

exports.onCreateWebpackConfig = ({ actions }) => {
  actions.setWebpackConfig({
    plugins: [
      new webpack.IgnorePlugin({
        resourceRegExp: /^netlify-identity-widget$/,
      }),
    ],
  })
}

Support

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

@one-builder/gatsby-theme-ob-mastergatsby-theme-ob-mastergatsby-theme-lumengatsby-theme-jdoe@leptest/gatsby-netlify-cms@fengshangwuqi/gatsby-configgatsby-theme-providencegatsby-theme-test@everything-registry/sub-chunk-1722klair.co@bjerra/gatsby-theme-bd-salong@brendantang/gatsby-starter-with-cms@chr.fritsch/gatsby-theme-blog@gatsby_theme/gatsby-theme-minimal@getecho/gatsby-theme-echo@m00n/gatsby-starter-docs-material-ui@mrozilla/gatsby-theme-netlify_cms@marscollective/gatsby-theme-jdoe@marscollective/gatsby-theme-link-free@marscollective/gatsby-theme-portfolio@jampile/gatsby-theme-conference@joshlu98/gatsby-theme-events@hyperobjekt/gatsby-theme-hypercore@hyperobjekt/gatsby-theme-hypersite@kjack/gatsby-theme-archive-site@cangir/gatsby-theme-cms-core@thepolicylab-projectportals/project-portal-content-netlify@teefe/vesper-blog@westegg/city-limits@westegg/core@westegg/gatsby-theme-core@w3f/gatsby-test@w3f/gatsby-theme-w3f@zalastax/nolb-gatsby-plugin-nfluent-rn-websitegatsby-theme-netlify-cmsgatsby-theme-jamfire-conferencegatsby-theme-materialgatsby-theme-medium-to-own-bloggatsby-theme-live-docgatsby-theme-bd-salonggatsby-theme-recipe-organizergatsby-theme-sales-sitegatsby-theme-sarvasyagatsby-theme-amaranthgatsby-theme-anchorgatsby-starter-hyperobjektgatsby-starter-hypersitegatsby-starter-lammagatsby-starter-lumengatsby-starter-netlify-tailwindgatsby-theme-advancedgatsby-starter-shopifygatsby-starter-docz-netlifycmsgatsby-theme-tatogatsby-theme-w3fgatsby-theme-cms-coregatsby-theme-demo-netlify-cmsgatsby-theme-developer-opgatsby-theme-digettgatsby-theme-hypercoregatsby-theme-hypersitegatsby-all-pack-theme-starterboost-cmsboff-theme
7.12.1

1 year ago

7.12.0

1 year ago

7.11.0-next.1

2 years ago

7.11.0-next.0

2 years ago

7.11.0

2 years ago

7.10.0

2 years ago

7.13.0-next.0

1 year ago

7.12.0-next.0

2 years ago

7.12.0-next.1

1 year ago

7.10.0-next.1

2 years ago

7.10.0-next.0

2 years ago

7.10.0-next.3

2 years ago

7.10.0-next.2

2 years ago

7.9.0

2 years ago

7.8.0-next.0

2 years ago

7.9.0-next.0

2 years ago

7.7.0

2 years ago

7.8.0

2 years ago

7.4.0

2 years ago

7.5.0

2 years ago

7.6.0

2 years ago

7.6.0-next.0

2 years ago

7.7.0-next.0

2 years ago

5.15.0

2 years ago

7.3.0

2 years ago

7.1.0-next.0

2 years ago

7.2.0-next.0

2 years ago

7.4.0-next.0

2 years ago

7.4.0-next.1

2 years ago

6.25.0

2 years ago

7.3.0-next.0

2 years ago

7.0.0-next.1

2 years ago

7.0.0-next.2

2 years ago

7.0.0-next.0

2 years ago

7.0.0

2 years ago

7.1.0

2 years ago

7.2.0

2 years ago

7.5.0-next.0

2 years ago

6.24.0-next.1

2 years ago

6.24.0-next.0

2 years ago

6.24.0

2 years ago

6.23.0-next.0

2 years ago

6.23.0

2 years ago

6.22.0

2 years ago

6.25.0-next.0

2 years ago

6.20.0

2 years ago

6.17.0

3 years ago

6.18.0-next.0

3 years ago

6.18.0-next.1

3 years ago

6.19.0-next.1

2 years ago

6.19.0-next.0

2 years ago

6.16.0

3 years ago

6.21.0-next.0

2 years ago

6.16.0-next.0

3 years ago

6.22.0-next.0

2 years ago

6.15.0

3 years ago

6.17.0-next.0

3 years ago

6.19.0

2 years ago

6.20.0-next.0

2 years ago

6.21.0

2 years ago

6.18.0

2 years ago

6.14.0-next.1

3 years ago

6.14.0-next.2

3 years ago

6.14.0-next.0

3 years ago

6.14.0

3 years ago

6.13.0

3 years ago

6.15.0-next.0

3 years ago

6.12.0-next.0

3 years ago

6.11.0-next.2

3 years ago

6.11.0-next.0

3 years ago

6.11.0-next.1

3 years ago

6.13.0-next.0

3 years ago

6.12.0

3 years ago

6.12.1

3 years ago

6.11.0

3 years ago

6.10.0

3 years ago

6.9.0

3 years ago

6.10.0-next.0

3 years ago

6.10.0-next.1

3 years ago

6.5.0

3 years ago

6.6.0

3 years ago

6.9.0-next.0

3 years ago

6.7.0

3 years ago

6.8.0

3 years ago

6.6.0-next.0

3 years ago

6.8.0-next.0

3 years ago

6.5.0-next.0

3 years ago

6.5.0-next.1

3 years ago

6.4.0-next.0

3 years ago

6.4.0-next.1

3 years ago

6.3.0

3 years ago

6.4.0

3 years ago

6.7.0-next.0

3 years ago

6.3.0-next.0

3 years ago

6.2.0

3 years ago

6.2.0-next.1

3 years ago

6.1.0

3 years ago

6.2.0-next.0

3 years ago

6.0.0

3 years ago

6.1.0-next.0

3 years ago

6.0.0-zz-next.2

3 years ago

5.14.0

3 years ago

6.0.0-zz-next.8

3 years ago

6.0.0-zz-next.1

3 years ago

6.0.0-next.0

3 years ago

6.0.0-next.1

3 years ago

5.14.0-next.2

3 years ago

5.14.0-next.1

3 years ago

5.13.0

3 years ago

5.14.0-next.0

3 years ago

5.12.0

3 years ago

5.13.0-next.0

3 years ago

5.12.0-next.3

3 years ago

5.12.0-next.2

3 years ago

5.12.0-next.1

3 years ago

5.11.0

3 years ago

5.12.0-next.0

3 years ago

5.10.0

3 years ago

5.11.0-next.0

3 years ago

5.10.0-next.1

3 years ago

5.9.0

3 years ago

5.10.0-next.0

3 years ago

5.8.0

4 years ago

5.9.0-next.0

4 years ago

5.8.0-next.1

4 years ago

5.8.0-next.0

4 years ago

5.5.0-next.2

4 years ago

5.5.0-next.0

4 years ago

5.5.0-next.1

4 years ago

4.10.1

4 years ago

5.4.1

4 years ago

5.4.0

4 years ago

5.6.0-next.0

4 years ago

5.6.0-next.1

4 years ago

5.5.0

4 years ago

5.4.0-next.1

4 years ago

5.7.0-next.2

4 years ago

5.7.0-next.1

4 years ago

5.7.0-next.0

4 years ago

5.6.0

4 years ago

5.7.1

4 years ago

5.7.0

4 years ago

5.3.0

4 years ago

5.4.0-next.0

4 years ago

5.3.0-next.1

4 years ago

5.2.0

4 years ago

5.3.0-next.0

4 years ago

5.1.0

4 years ago

5.2.0-next.0

4 years ago

5.1.0-next.3

4 years ago

5.0.0

4 years ago

5.1.0-next.0

4 years ago

5.1.0-next.1

4 years ago

5.1.0-next.2

4 years ago

5.0.0-v3rc.0

4 years ago

5.0.0-v3rc.1

4 years ago

5.0.0-next.2

4 years ago

5.0.0-next.1

4 years ago

5.0.0-next.0

4 years ago

4.10.0

4 years ago

4.11.0-next.0

4 years ago

4.9.0

4 years ago

4.10.0-next.0

4 years ago

4.9.0-next.1

4 years ago

4.8.0

4 years ago

4.9.0-next.0

4 years ago

4.7.0

4 years ago

4.8.0-next.1

4 years ago

4.8.0-next.0

4 years ago

4.6.0

4 years ago

4.7.0-next.0

4 years ago

4.5.0

4 years ago

4.6.0-next.0

4 years ago

4.4.0

4 years ago

4.4.0-next.1

4 years ago

4.5.0-next.0

4 years ago

4.4.0-next.0

4 years ago

4.3.17

4 years ago

4.3.16

4 years ago

4.3.15

4 years ago

4.3.14

4 years ago

4.3.13

4 years ago

4.3.12

4 years ago

4.3.11

4 years ago

4.3.10

4 years ago

4.3.9

4 years ago

4.3.7

5 years ago

4.3.6

5 years ago

4.3.5

5 years ago

4.3.4

5 years ago

4.3.3

5 years ago

4.3.2

5 years ago

4.3.1

5 years ago

4.3.0

5 years ago

4.2.5

5 years ago

4.2.4

5 years ago

4.2.3

5 years ago

4.2.2

5 years ago

4.2.1

5 years ago

4.1.44

5 years ago

4.2.0

5 years ago

4.1.43

5 years ago

4.1.42

5 years ago

4.1.41

5 years ago

4.1.40

5 years ago

4.1.39

5 years ago

4.1.38

5 years ago

4.1.37

5 years ago

4.1.36

5 years ago

4.1.35

5 years ago

4.1.34

5 years ago

4.1.33

5 years ago

4.1.31

5 years ago

4.1.30

5 years ago

4.1.29

5 years ago

4.1.28

5 years ago

4.1.27

5 years ago

4.1.26

5 years ago

4.1.25

5 years ago

4.1.24

5 years ago

4.1.23

5 years ago

4.1.22

5 years ago

4.1.21

5 years ago

4.1.19

5 years ago

4.1.18

5 years ago

4.1.17

5 years ago

4.1.16

5 years ago

4.1.15

5 years ago

4.1.14

5 years ago

4.1.13

5 years ago

4.1.12

5 years ago

4.1.11

5 years ago

4.1.10

5 years ago

4.1.9

5 years ago

4.1.8

5 years ago

4.1.7

5 years ago

4.1.6

5 years ago

4.1.5

5 years ago

4.1.4

5 years ago

4.1.3

5 years ago

4.1.2

5 years ago

4.1.1

5 years ago

4.1.0

6 years ago

4.0.3

6 years ago

4.0.2

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.0.18

6 years ago

3.0.17

6 years ago

3.0.16

6 years ago

3.0.15

6 years ago

3.0.14

6 years ago

3.0.13

6 years ago

3.0.12

6 years ago

3.0.11

6 years ago

3.0.10

6 years ago

3.0.9

6 years ago

3.0.8

6 years ago

3.0.7

6 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

3.0.0-rc.5

6 years ago

3.0.0-rc.4

6 years ago

3.0.0-rc.3

6 years ago

3.0.0-rc.2

6 years ago

3.0.0-rc.1

6 years ago

3.0.0-rc.0

6 years ago

3.0.0-beta.4

6 years ago

3.0.0-beta.3

6 years ago

3.0.0-beta.2

6 years ago

3.0.0-beta.1

6 years ago

2.0.0-beta.7

6 years ago

2.0.0-beta.6

6 years ago

2.0.0-beta.5

6 years ago

2.0.0-beta.4

6 years ago

2.0.0-beta.3

7 years ago

2.0.0-beta.2

7 years ago

2.0.0-beta.1

7 years ago

2.0.0-beta.0

7 years ago

2.0.0-alpha.2

7 years ago

2.0.0-alpha.1

7 years ago

1.0.8-13

7 years ago

1.0.8-12

7 years ago

1.0.8-11

7 years ago

1.0.8-10

7 years ago

1.0.8-9

7 years ago

1.0.8-7

7 years ago

1.0.8-6

7 years ago

1.0.8-5

7 years ago

1.0.8-4

7 years ago

2.0.1

7 years ago

1.0.8-3

7 years ago

1.0.12

7 years ago

1.0.8-2

7 years ago

1.0.8-1

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.8-0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago