/GatsbyJS

GatsbyJS with Contentful (Gatsby theme novel)

The API-First CMS to Power All Digital Products | Contentful is powerful to manage content service, it can make you easy to manage your content, you ever didn’t need to build an CMS.


Tutorial for begin

Gatsby And Contentful — The Headless CMS Approach - CodingTheSmartWay.com Blog - Medium

Install contentful-cli

GitHub - contentful/contentful-cli: The official Contentful command line interface. Use Contentful features straight from the command line!

$ yarn global add contentful-cli

Next, you need to create a new workspace on contentful, to get space_id and access_token.

Import model

contentful-cli/docs/space/import at master · contentful/contentful-cli · GitHub

$ contentful space import --content-file contentful-export.json

gatsby-theme-novela/@narative/gatsby-theme-novela/contentful at master · narative/gatsby-theme-novela · GitHub

gatsby-theme-novela/@narative/gatsby-theme-novela/contentful/contentful-export.json

If any prompts, set it.

Following step by step

GitHub - narative/gatsby-theme-novela: Welcome to Novela, the simplest way to start publishing with Gatsby.

$ yarn add gatsby-source-contentful dotenv

.env

CONTENTFUL_SPACE_ID=
CONTENTFUL_ACCESS_TOKEN=

gatsby-config.js

require("dotenv").config();

plugins: [
  {
    resolve: "gatsby-source-contentful",
    options: {
      spaceId: process.env.CONTENTFUL_SPACE_ID,
      accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
    },
  },
  {
    resolve: "@narative/gatsby-theme-novela",
    options: {
      sources: {
        contentful: true,
      },
    },
  },
];
Yish

Yish

The creator of yish.dev

Read More