Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbukuts/gatsby-contentful-blog
Gatsby Blog with Contentful as CMS
https://github.com/jbukuts/gatsby-contentful-blog
contentful gatsby react static-site
Last synced: about 20 hours ago
JSON representation
Gatsby Blog with Contentful as CMS
- Host: GitHub
- URL: https://github.com/jbukuts/gatsby-contentful-blog
- Owner: jbukuts
- Created: 2023-01-10T20:43:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-15T10:03:16.000Z (about 2 years ago)
- Last Synced: 2023-03-06T23:05:23.916Z (almost 2 years ago)
- Topics: contentful, gatsby, react, static-site
- Language: TypeScript
- Homepage:
- Size: 3.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Getting started
In order to run this site you'll need a Contentful account set up with the relavant data. This site pulls data in from a Contentful content model called a `BlogPost` that contains only a string field called `Title`, a string field for `Description`, and a rich text field for `Content`.
Once you have that setup, in order to start the site there are a few environment variables to setup locally. First ensure that there is a `.env.development` file at the projects root directory with the variables:
- CONTENTFUL_API_KEY: Contentful access token
- CONTENTFUL_SPACE: Contentful space for data to be source from
- CONTENTFUL_ENV: contentful environment you wanted your data sourced fromFrom here you can then run `npm ci` to install dependencies.
### Start site locally
Then to start the site locally you can run `npm run dev` for development mode
### Test production build
In order to test a production build you can run `npm run build`. After that command exits successfully you can then use a local python http server to host the static pages via `python -m http.server -d ./public` if you have python 3 or in the built-in `npm run serve` to test a production build.
## Deployment
This site is built as a collection of static pages and deployed via Github pages. This is accomplished during every pull request merge made into the `main` branch as well as a webhook dispacth made from Contentful. For reference on how this is achieved take a look atthe `./.github/workflows/deploy_static_site.yml` to see the jobs that are ran.