A sprout template for creating a static CMS in Roots using Contentful and Netlify. Please go through the setup steps before running the template.
npm install sprout-cli -g
sprout add static-cms https://github.com/carrot/sprout-static-cms.git
You should sign up for a Contentful and Netlify account before using this template as you will need an access token for both to complete the template configuration.
You will need the following set up before you run this:
OAuth apps
sprout init static-cms my-static-site
Once your static CMS project is set up, this template will also give you useful generators. These generators rely on contentful.coffee
in order to provide the credentials needed to interact with Contentful, do not move this file if you need to use a generator.
Sprout-static-cms comes equipped with a Contentful Content Model generator. Pass in the Content Model's name followed by a list of fields to generate following a name:type
format, for example:
sprout run static-cms model Post title:text description:text slug:symbol date:date rank:integer price:number private:boolean
If you don't specify a field type, sprout will default to a text field.
In order to run the tests, you'll need to add a couple environment variables. This project is setup to use dotenv, so all you should need to do is add a .env
file with the following variables:
DELIVERY_TOKEN=XXXXXXXXXXXX
MANAGEMENT_TOKEN=XXXXXXXXXXXX
SPACE_ID=XXXXXXXXXXXX
You should use a test Contentful account (i.e. not in use in production) to populate these values.