Deep Dive

“The fastest auto dealership site in the world” Hundreds of hours of perf learnings, distilled

ContactSign Up for Free
Community Plugin
View plugin on GitHub

gatsby-source-drupal-graphql

Source plugin for pulling data (including images) into Gatsby from Drupal sites using GraphQL.

It pulls data from Drupal 9+ sites with the Drupal GraphQL Compose module installed.

Install

npm install gatsby-source-drupal-graphql

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-drupal-graphql`,
      options: {
        baseUrl: process.env.DRUPAL_BASE_URL,
        endPoint: process.env.DRUPAL_ENDPOINT,
        concurrency: 10, // defaults to 1
        incrementalChanges: true, // defaults to false
        auth: {
          // Using a String token value
          token: process.env.DRUPAL_AUTH_TOKEN,
          // Using Simple OAuth module
          oauth: {
            baseUrl: process.env.DRUPAL_BASE_URL,
            user: process.env.DRUPAL_AUTH_USERNAME,
            password: process.env.DRUPAL_AUTH_PASSWORD,
            clientId: process.env.DRUPAL_AUTH_CLIENT_ID
          },
          inlineImages: {
            'NodeArticle': ['body'],
            'NodePage': ['body'],
          }
        },
      },
    },
  ],
}
© 2022 Gatsby, Inc.