Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-source-drupal7

A source plugin for Gatsby that pulls data from Drupal 7.

This source plugin has been forked from gatsby-source-drupal to extend functionality to Drupal 7.

Requirements:

Drupal 7 site with the following modules installed and enabled:

Install:

npm install --save gatsby-source-drupal7

Configuration:

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-drupal7`,
      options: {
        baseUrl: `https://live-mydrupal7site.pantheonsite.io/`,
        apiBase: `restws_resource.json`, // optional, defaults to `restws_resource.json`
      },
    },
  ],
}

Auth:

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-drupal7`,
      options: {
        baseUrl: `https://live-mydrupal7site.pantheonsite.io/`,
        apiBase: `restws_resource.json`, // optional, defaults to `restws_resource.json`
        basicAuth: {
          username: process.env.BASIC_AUTH_USERNAME,
          password: process.env.BASIC_AUTH_PASSWORD,
        },
      },
    },
  ],
}

Querying:

{
  allNode {
    edges {
      node {
        data {
          title
          created
          body {
            value
          }
        }
      }
    }
  }
}
© 2023 Gatsby, Inc.