Gatsby Contentful starter for creating a blog
Static sites are scalable, secure and have very little required maintenance. They come with a drawback though. Not everybody feels good editing files, building a project and uploading it somewhere. This is where Contentful comes into play.
With Contentful and Gatsby you can connect your favorite static site generator with an API that provides an easy to use interface for people writing content and automate the publishing using services like Travis CI or Netlify.
- Simple content model and structure. Easy to adjust to your needs.
- Contentful integration using our Sync API
- Using our Delivery API.
- Responsive/adaptive images via gatsby-image
This project is part of contentful-userland which means that we’re always open to contributions and you can be part of userland and shape the project yourself after your first merged pull request. You can learn more about how contentful userland is organized by visiting our about repository.
To use this project you have to have a Contentful account. If you don't have one yet you can register at www.contentful.com/sign-up.
$ git clone [email protected]:contentful-userland/gatsby-contentful-starter.git
$ npm i
Or use the Gatsby CLI.
$ gatsby new contentful-starter https://github.com/contentful-userland/gatsby-contentful-starter
This project comes with a Contentful setup command npm run setup
.
This command will ask you for a space ID, and access tokens for the Contentful Management and Delivery API and then import the needed content model into the space you define and write a config file (./contentful.json
).
npm run setup
automates that for you but if you want to do it yourself rename .contentful.json.sample
to .contentful.json
and add your configuration in this file.
This project comes with a few handy commands for linting and code fixing. The most important ones are the ones to develop and ship code. You can find the most important commands below.
Run in the project locally.
Run a production build into ./public
. The result is ready to be put on any static hosting you prefer.
Run a production build into ./public
and publish the site to GitHub pages.
Removes all dependencies, scripts and data from the installation script.
- Tutorial video series "Building a blazing fast website with GatsbyJS and Contentful" by @Khaledgarbaya