Gatsby and Netlify CMS experiment
voidcluster
Gatsby and Netlify CMS experiment based on the Gatsby + Netlify CMS Starter.
Getting Started (Recommended)
Netlify CMS can run in any frontend web environment, but the quickest way to try it out is by running it on a pre-configured starter site with Netlify. This example (voidcluster) strips the Gatsby + Netlify CMS Starter Kaldi coffee company template (itself adapted from One Click Hugo CMS, thanks Austin Green) down to a simple blog. Use the button below to build and deploy your own copy of the repository:
After clicking that button, you’ll authenticate with GitHub and choose a repository name. Netlify will then automatically create a repository in your GitHub account with a copy of the files from the template. Next, it will build and deploy the new site on Netlify, bringing you to the site dashboard when the build is complete. Next, you’ll need to set up Netlify’s Identity service to authorize users to log in to the CMS.
Access Locally
git clone https://github.com/rdela/voidcluster.git
cd voidcluster
yarn
yarn develop
To test the CMS locally, you'll need run a production build of the site:
yarn build
yarn serve
Getting Started (Without Netlify)
gatsby new [SITE_DIRECTORY_NAME] https://github.com/rdela/voidcluster
cd [SITE_DIRECTORY_NAME]
yarn
yarn build
yarn serve
Setting up the CMS
Follow the Netlify CMS Quick Start Guide to set up authentication, and hosting.
Deploy settings
Netlify / ENV vars
[build]
command = "gatsby build"
publish = "public/"
[build.environment]
NODE_ENV = "production"
NODE_VERSION = "--lts"
NPM_VERSION = "[X.X.X]"
RUBY_VERSION = "default"
YARN_FLAGS = "--no-ignore-optional"
YARN_VERSION = "[X.X.X]"
See current NPM_VERSION or YARN_VERSION.
Netlify TOML reference
Netlify > Continuous Deployment > Deploy Contexts
To configure deploy contexts, you must create a file called
netlify.toml
in the base of your Git repository.
Netlify > Continuous Deployment > Set Node, Ruby, or Python version
Set a
NODE_VERSION
environment variable.
The value inside can be anything you would use with nvm.
Node Version Manager
NVM > Usage
In place of a version pointer like "0.10" or "5.0" or "4.2.1",
you can use the following special default aliases
node
: this installs the latest version ofnode
NVM > .nvmrc
For example, to make nvm default to the latest 5.9 release, the latest LTS version, or the latest node version for the current directory:
$ echo "5.9" > .nvmrc
$ echo "lts/*" > .nvmrc # to default to the latest LTS version
$ echo "node" > .nvmrc # to default to the latest version
NPM_VERSION
- Version corresponding with Node.js version. (default)
- Any version available via NPM.
RUBY_VERSION = "default"
There to appease quirk that begat this lag/error I was seeing in deploy logs:
Attempting ruby version 2.2.3, read from environment
** WARNING **
Using custom ruby version 2.2.3, this will slow down the build.
To ensure fast builds, set the RUBY_VERSION environment variable,
or .ruby-version file, to an included ruby version.
Included versions: 2.2.9 2.4.3 2.3.6
Netlify > Continuous Deployment > Set Node, Ruby, or Python version
We support any released version of Ruby that rvm understands.
RVM > Switching between ruby versions
default
- default ruby (or the system ruby if a default hasn't been set)system
- system ruby (state before RVM was installed)
YARN_FLAGS + YARN_VERSION
See these commits on the Gatsby Netlify CMS starter.
Update netlify.toml
Add "--no-ignore-optional" for netlify
Further Reading on Netlify Deployment and ENV vars
Netlify Blog > Introducing Deploy Previews in Netlify
Netlify Blog > Introducing Deploy Contexts in Netlify
License
https://docs.npmjs.com/files/package.json#license
You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.
If you are using a license that hasn't been assigned an SPDX identifier, or if you are using a custom license, use a string value like this one:
{ "license" : "SEE LICENSE IN <filename>" }
OpenBSD license
in license.txt
Consider also setting "private": true to prevent accidental publication.
{
"license": "SEE LICENSE IN license.txt",
"private": true
}