{"id":19447859,"url":"https://github.com/decaporg/gatsby-plugin-decap-cms","last_synced_at":"2025-04-25T02:30:28.685Z","repository":{"id":208970624,"uuid":"722524483","full_name":"decaporg/gatsby-plugin-decap-cms","owner":"decaporg","description":"A Gatsby plugin which generates the Decap CMS single page app","archived":false,"fork":false,"pushed_at":"2024-02-02T08:55:09.000Z","size":476,"stargazers_count":5,"open_issues_count":5,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-19T10:24:57.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/decaporg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-23T10:36:26.000Z","updated_at":"2024-10-19T17:38:24.000Z","dependencies_parsed_at":"2024-02-02T09:47:24.609Z","dependency_job_id":"d81d37d9-09d9-4e6e-9808-f626a8b5db54","html_url":"https://github.com/decaporg/gatsby-plugin-decap-cms","commit_stats":null,"previous_names":["decaporg/gatsby-plugin-decap-cms"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decaporg%2Fgatsby-plugin-decap-cms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decaporg%2Fgatsby-plugin-decap-cms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decaporg%2Fgatsby-plugin-decap-cms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decaporg%2Fgatsby-plugin-decap-cms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/decaporg","download_url":"https://codeload.github.com/decaporg/gatsby-plugin-decap-cms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250741850,"owners_count":21479679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T16:21:06.016Z","updated_at":"2025-04-25T02:30:28.118Z","avatar_url":"https://github.com/decaporg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gatsby-plugin-decap-cms\n\n**Gatsby v1 and Netlify CMS 1.x require [`gatsby-plugin-netlify-cms@^2.0.0`][1].**\n\n**Gatsby v2 and Netlify CMS 2.x require [`gatsby-plugin-netlify-cms@^3.0.0`][2].**\n\n**Gatsby v5 and Decap CMS (decap-cms-app) 3.x require `gatsby-plugin-decap-cms@^4.0.0`, which is documented below.**\n\n## Overview\n\nAutomatically generates an `admin/index.html` with a default Decap CMS implementation.\n\nDecap CMS is a React single page app for editing git based content via API.\nIts built for non-technical and technical editors alike, and its super easy to\ninstall and configure. For more details, check out the [docs\nsite](https://decapcms.org/docs).\n\n## Install\n\n```shell\nnpm install decap-cms-app gatsby-plugin-decap-cms\n```\n\n## How to use\n\nAdd the Decap CMS plugin in your `gatsby-config.js`:\n\n```javascript\nplugins: [`gatsby-plugin-decap-cms`]\n```\n\nThen add your Decap CMS [configuration\nfile](https://www.decapcms.org/docs/add-to-your-site/#configuration) in\n`static/admin/config.yml`.\n\n## Options\n\nDecap CMS can be configured via the plugin options below. You can learn\nabout how to pass options to plugins in the [Gatsby\ndocs](https://www.gatsbyjs.com/docs/plugins/#how-to-use-gatsby-plugins).\n\n### `modulePath`\n\n(_optional_, type: `string | Array\u003cstring\u003e`, default: `undefined`)\n\nIf you need to customize Decap CMS, e.g. registering [custom\nwidgets](https://www.decapcms.org/docs/custom-widgets/#registerwidget) or\nstyling the [preview\npane](https://www.decapcms.org/docs/customization/#registerpreviewstyle),\nyou'll need to do so in a JavaScript module and provide Gatsby with the path to\nyour module via the `modulePath` option. Any styles imported by this module (or\nby the modules that it imports, all the way down the chain) are automatically\napplied to the editor preview pane by the plugin.\n\n```javascript\nplugins: [\n  {\n    resolve: `gatsby-plugin-decap-cms`,\n    options: {\n      /**\n       * One convention is to place your Decap CMS customization code in a\n       * `src/cms` directory.\n       */\n      modulePath: `${__dirname}/src/cms/cms.js`,\n    },\n  },\n]\n```\n\nThe js module might look like this:\n\n```javascript\n/**\n * The default export of `decap-cms-app` is an object with all of the Decap CMS\n * extension registration methods, such as `registerWidget` and\n * `registerPreviewTemplate`.\n */\nimport CMS from \"decap-cms-app\"\n\n/**\n * Any imported styles should be automatically be applied to the editor preview\n * pane thus eliminating the need to use `registerPreviewStyle` for imported\n * styles. However if you are experiencing build errors regarding importing css,\n * sass or scss into a cms module when deploying to the netlify platform, you\n * may need to follow the implementation found in netlify documentation here:\n * https://www.decapcms.org/docs/beta-features/#raw-css-in-registerpreviewstyle\n * All of the example imports below would result in styles being applied to the\n * preview pane.\n */\nimport \"module-that-imports-styles.js\"\nimport \"styles.scss\"\nimport \"../other-styles.css\"\n\n/**\n * Let's say you've created widget and preview components for a custom image\n * gallery widget in separate files:\n */\nimport ImageGalleryWidget from \"./image-gallery-widget.js\"\nimport ImageGalleryPreview from \"./image-gallery-preview.js\"\n\n/**\n * Register the imported widget:\n */\nCMS.registerWidget(`image-gallery`, ImageGalleryWidget, ImageGalleryPreview)\n```\n\n### `manualInit`\n\n(_optional_, type: `boolean`, default: `false`)\n\nSet this to `true` If you need to [manually initialize](https://www.decapcms.org/docs/beta-features/#manual-initialization) Decap CMS. The plugin will take care of setting `window.CMS_MANUAL_INIT` to `true`:\n\n```javascript\nplugins: [\n  {\n    resolve: `gatsby-plugin-decap-cms`,\n    options: {\n      manualInit: true,\n    },\n  },\n]\n```\n\nThe js module might look like this:\n\n```javascript\nimport CMS from \"decap-cms-app\"\n\n/**\n * Optionally pass in a config object. This object will be merged into `config.yml` if it exists\n */\n\nCMS.init({\n  config: {\n    backend: {\n      name: \"git-gateway\",\n    },\n  },\n})\n```\n\n### `enableIdentityWidget`\n\n(_optional_, type: `boolean`, default: `true`)\n\n`enableIdentityWidget` is `true` by default, allowing [Netlify\nIdentity](https://www.netlify.com/docs/identity/) to be used without\nconfiguration. Disable it when not using Netlify Identity to reduce bundle size.\n\n```javascript\nplugins: [\n  {\n    resolve: `gatsby-plugin-decap-cms`,\n    options: {\n      enableIdentityWidget: true,\n    },\n  },\n]\n```\n\n### `publicPath`\n\n(_optional_, type: `string`, default: `\"admin\"`)\n\nCustomize the path to Decap CMS on your Gatsby site.\n\n### `htmlTitle`\n\n(_optional_, type: `string`, default: `Content Manager`)\n\nCustomize the value of the `title` tag in your CMS HTML (shows in the browser\nbar).\n\n### `htmlFavicon`\n\n(_optional_, type: `string`, default: `\"\"`)\n\nCustomize the value of the `favicon` tag in your CMS HTML (shows in the browser\nbar).\n\n### `includeRobots`\n\n(_optional_, type: `boolean`, default: `false`)\n\nBy default, the CMS page is not indexed by crawlers. Use this to add a `meta` tag to invite robots to index the CMS page.\n\n### `customizeWebpackConfig`\n\n(_optional_, type: `function`)\n\nFunction to customize webpack configuration.\n\nFunction parameters:\n\n- config: webpack configuration for DecapCMS\n- destructured object from onCreateWebpackConfig { store, stage, pathPrefix, getConfig, rules, loaders, plugins} as seen in https://www.gatsbyjs.com/docs/node-apis/#onCreateWebpackConfig\n\n```javascript\nplugins: [\n  {\n    resolve: `gatsby-plugin-decap-cms`,\n    options: {\n      customizeWebpackConfig: (config, { plugins }) =\u003e {\n        const Plugin = require(\"...\")\n\n        config.plugins.push(\n          plugins.define({\n            \"process.env.MY_VAR\": JSON.stringify(\"my var value\"),\n          })\n        )\n\n        config.plugins.push(new Plugin())\n      },\n    },\n  },\n]\n```\n\n## Example\n\nHere is the plugin with example values for all options (note that no option is\nrequired):\n\n```javascript\nplugins: [\n  {\n    resolve: `gatsby-plugin-decap-cms`,\n    options: {\n      modulePath: `path/to/custom/script.js`, // default: undefined\n      enableIdentityWidget: true,\n      publicPath: `admin`,\n      htmlTitle: `Content Manager`,\n      htmlFavicon: `path/to/favicon`,\n      includeRobots: false,\n    },\n  },\n]\n```\n\n## Disable widget on site\n\nIf 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`:\n\n```javascript\nconst webpack = require(`webpack`)\n\nexports.onCreateWebpackConfig = ({ actions }) =\u003e {\n  actions.setWebpackConfig({\n    plugins: [\n      new webpack.IgnorePlugin({\n        resourceRegExp: /^netlify-identity-widget$/,\n      }),\n    ],\n  })\n}\n```\n\n## Support\n\nFor help with integrating Decap CMS with Gatsby, check out the community\n[Discord](https://www.decapcms.org/chat).\n\n[1]: https://github.com/gatsbyjs/gatsby/blob/gatsby-plugin-netlify-cms@2.0.1/packages/gatsby-plugin-netlify-cms/README.md\n[2]: https://github.com/gatsbyjs/gatsby/blob/gatsby-plugin-netlify-cms@3.0.18/packages/gatsby-plugin-netlify-cms/README.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecaporg%2Fgatsby-plugin-decap-cms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecaporg%2Fgatsby-plugin-decap-cms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecaporg%2Fgatsby-plugin-decap-cms/lists"}