- Gatsby with React
- Contentful
- Netlify
- Install nvm with the following command
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
- Install specific node version (10.22.0 Recommended)
nvm install 10.22.0
nvm use 10.22.0
- Install yarn (follow this instruction)
brew install yarn
- Go to the directory
cd netlify-gatsby-contentful
- Install packages
yarn
- Create a file
.env.development
and paste the following with properCONTENTFUL_SPACE_ID
,CONTENTFUL_ACCESS_TOKEN
andCONTENTFUL_MANAGEMENT_TOKEN
CONTENTFUL_SPACE_ID='<Get the spaceId from contentful Settings > API Keys > Content Delivery Token'
CONTENTFUL_ACCESS_TOKEN='<Get the spaceId from contentful Settings > API Keys > Content Delivery Token>'
CONTENTFUL_MANAGEMENT_TOKEN='<Get management token from Settings > API Keys > Content Management Token'
CONTENTFUL_ENV='dev'
- Follow the commands
Run in the project locally and visit http://localhost:8000
Run a production build into ./public
. The result is ready to be put on any static hosting you prefer.
To export dev environment data
yarn run export:dev
To export master environment data
yarn run export:master
To import dev environment data
yarn run import:dev --filename=<name of the file you want to import>
To import master environment data. BE CAREFUL WHILE RUNNING THIS SCRIPT. IT WILL OVERWRITE ALL THE MASTER CONTENTS
yarn run import:master --filename=<name of the file you want to import>