0.0.8 • Published 4 years ago

@mrozilla/gatsby-theme-netlify_cms v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

gatsby-theme-netlify_cms

A Gatsby theme using Netlify CMS and MDX. The theme uses netlify-cms-backend-fs for local development.

Install

npm install --save gatsby-theme-netlify_cms

How to use

Add theme to the plugins field in your gatsby-config.js.

module.exports = {
  //...
  plugins: [
    { resolve: '@mrozilla/gatsby-theme-netlify_cms' },
    //...
  ],
  //...
};

CMS Configuration

You can extend the Netlify CMS configuration options by shadowing the config.js file. See the default config set by the theme to understand the existing structure.

// src/gatsby-theme-netlify_cms/config.js

import config from '@mrozilla/gatsby-theme-netlify_cms/src/config';

// e.g. add a new block type

config.collections = [
  ...config.collections.map((collection) => {
    if (collection.name === 'pages') {
      return {
        ...collection,
        fields: collection.fields.map((field) => {
          if (field.name === 'blocks') {
            return { 
              ...field, 
              types: [
                ...field.types, 
                { name: 'New', fields: [{name: 'title'}] }
              ],
            };
          }
          return field;
        }),
      };
    }
    return collection;
  }),
];

export default config;

Change Log

This project adheres to Semantic Versioning. Every release is documented on the Github Releases page.

License

MIT (c) Jan Hrubý