Skip to content

Aron-HD/joshhd-portfolio

Repository files navigation

joshhd.co.uk

JavaScript Gatsby GraphQL HTML5 SASS Styled Components GitHub Actions

Creative portfolio website for joshhd.co.uk.

Netlify Status

Built with Gatsby, Contentful and GraphQL, deployed via Netlify, managed with kanban project in GitHub.


Requirements

  • tested to node v18.20.4, v21.x
  • install using nvm install 18
  • use elevated shell to set nvm to use this version: nvm use 18

Setup

  • install dependencies
  • [!] node-gyp errors relating to visual studio can be resolved by running in VS Command Prompt to ensure native build tools are used for C++.
npm i
  • run setup script
npm run setup

Exporting Contentful Data

  • Install Contentful CLI if you haven't
npm install -g contentful-cli
  • Login to Contentful
contentful login
  • paste the code from the browser to the cli
  • get Space Id and content delivery token from Settings > Api keys
  • Export your space data
contentful space export `
  --space-id YOUR_SPACE_ID `
  --management-token YOUR_MANAGEMENT_TOKEN `
  --export-dir ./contentful `
  --content-file export.json

Environment variables

  • [!] Note: Setup script creates these for you.

Put Contentful env variables in .env.production file:

CONTENTFUL_SPACE_ID=<space-id>
CONTENTFUL_ACCESS_TOKEN=<access-token>

To set the node environment to pick these up during build and serve:

"scripts": {
    "build": "set NODE_ENV=production& gatsby build",
    "serve": "set NODE_ENV=production& gatsby serve"
}