netliferesearch / netlife2019

Netlife 2019 & beyond
http://netlife2019.netlify.com
6 stars 1 forks source link
gatsby netlify sanity tailwind

Netlife 2019

Netlify Status

Monorepo for the netlife.com website.

Tech stack

Development

  1. Copy the file .env.development.template and name it .env.development. Paste in the secret tokens in the empty strings. You can find the secret token on 1password - search for "Sanity Netlife.com Read token"
  2. Run npm install in the root of the project. Lerna will handle installation for the backend and frontend.
  3. Run npm run dev to start the Sanity studio (localhost:3333) and Gatsby (localhost:8000).
  4. Deploy Sanity schema changes by running npm run graphql-deploy.
  5. Changes made to the Gatsby config files requires Gatsby to be restarted.
  6. Run tests in /web by writing npm run test

Forms

Forms are using Netlify forms hook. To create a new form. Use unique form name and deploy to Netlify. Your form name should be in the forms section list in Netlify after your first submission. You need to do some setup for that specific form in the section Settings and usage. Form name "default" is used as a default form to hei@netlife.com. Others are using the page slug for now.

Sanity Studio (CMS)

To makes changes to the content, go to: https://netlife2019-studio.netlify.com

The admin can add additional users.

Deployment

We use Netlify as a web host. This GitHub repo is connected Netlify, and Netlify will build whenever code is pushed to the master branch. Netlify also handles our serverless functions.

Netlify is also connected to Sanity with a webhook, and will build when something is changed in Sanity.

It should build in about a minute. If nothing changes then something in the build process went wrong. The build log in Netlify should tell you what. It is recommended connecting a Slack bot between the Netlify site and your Slack user when developing. If something goes wrong the last working version will be the version deployed in production.

Build hooks are broken

TODO: Exersize for the reader. Until then, build manually by sanity deploy from /studio and manual restart of Gatsby preview in gatsbyjs.com dashboard.

Project rules

How the internal link system works

Advanced links supports external and internal URLs, and the nofollow attribute.

To link something to a document i Sanity you select the document you want to reference to in the dropdown menu.

If you want to add a new document that can be linked to, you have to add a field called slug, it has to have a value, so make it required.

Edit the following files:

You will need to restart Gatsby and deploy the graphql schemas at some point while doing this.