Skip to content

How to setup Prismic

Joseph Pereniguez edited this page Aug 17, 2023 · 6 revisions

Add and manage your content easily with Prismic by creating an account here!

1. 🚀 Create your project.

On Prismic, create a new project and select the Gatsby as the technology used in the codebase.

Capture d’écran 2023-08-17 à 17 15 38

2. 📑 Add your first document type.

Create your first document type and name it homepage. To quickly get through the page creation, copy the entire content of the src/schemas/homepage.json file in the JSON editor side panel then save it.

Copy json

3. 🖋️ Add your homepage content.

Navigate through the Documents section and create your first document. It should be a homepage document as you previously created its document type. Then you can add some content in the empty fields. Once it's done, you can save and publish your changes.

Capture d’écran 2023-08-17 à 17 25 10

4. 🔒 Create the API secrets.

In order to be able to query your content from the front-end of your app you'll need the Prismic secrets of your project. To create them, navigate to the API and Security section and generate an access token by adding the name of your application name (no need to add a Callback URL) then click on the Add this application button.

create Prismic secrets

You should now have a permanent access token. Copy it and past it in your .env file for the PRISMIC_ACCESS_TOKEN key. Don't forget to also add the PRISMIC_REPOSITORY_NAME in your .env too.

If you already have (or haven't) created your Netlify account and connected your Github project, you can also add these environment variables following this documentation.