Skip to content

OsioLabs/gatsby-source-drupal

Repository files navigation

Fork Alert!

This is a fork of the original project which is part of the GatsbyJS mono repo. This allows us to more easily maintain the changes we're using in production while working on getting them incorporated upstream. Eventually we can hopefully stop using this fork and go back to using the official GatsbyJS version of the plugin.

Current open/related issues:

gatsby-source-drupal

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

Pulls data from Drupal 8 sites with the Drupal JSONAPI module installed.

An example site built with the headless Drupal distro ContentaCMS is at https://using-drupal.gatsbyjs.org/

apiBase Option allows changing the API entry point depending on the version of jsonapi used by your Drupal instance. The default value is jsonapi, which has been used since jsonapi version 8.x-1.0-alpha4.

Install

npm install --save gatsby-source-drupal

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-source-drupal`,
    options: {
      baseUrl: `https://live-contentacms.pantheonsite.io/`,
      apiBase: `api`, // optional, defaults to `jsonapi`
    },
  },
];

How to query

You can query nodes created from Drupal like the following:

{
  allArticle {
    edges {
      node {
        title
        internalId
        created(formatString: "DD-MMM-YYYY")
      }
    }
  }
}

Releases

No releases published

Packages

No packages published