Skip to content

ppigm/blog.ppigm.org

Repository files navigation

PPI Greater Manchester Blogs

A Gatsby blog powered by Contentful.

Preface

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.

Getting started

See our official Contentful getting started guide.

1. Get the source code and install dependencies.

$ git clone https://github.com/ppigm/blog.ppigm.org.git
$ npm install

2. Set up of the needed content model and create a configuration file

This project comes with a Contentful setup command npm run setup

This command will ask you for a spaceID, and access tokens for the Contentful Management and Delivery API.

Crucial Commands

npm run dev

Run the project locally with live reload in development mode.

npm run build

Run a production build into ./public. The result is ready to be put on any static hosting you prefer.

npm run serve

Spin up a production-ready server with your blog. Don't forget to build your page beforehand.


Guides

Deployment

See the official Contentful getting started guide.

A blog on your local machine is nice to have, but a blog on the internet is even better. Return to the tutorial doc, select a hosting service (Gatsby Cloud, Netlify, or Heroku) and follow the instructions to deploy.

Explore the blog content structure

Return to the tutorial doc to view the relationship between the blog content and the data model.

Modify content and redeploy

Follow this tutorial to learn how to use webhooks to automate the process of redeploying your site after publishing new content.


Contribution

Feel free to open pull requests to fix bugs. If you want to add features, please have a look at the original version. It is always open to contributions and pull requests.

You can learn more about how Contentful userland is organized by visiting our about repository.