0.0.13 • Published 5 years ago

gatsby-directus v0.0.13

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

Gatsby Directus

Build Status

A Gatsby source plugin for Directus.

Features

This plugin converts your Directus content schema into Gatsby nodes. Allowing you to use your data in Directus to build out your static sites.

  • Converts image columns into image sharp compatible gatsby nodes
    • requires gatsby-image
    • requires gatsby-plugin-sharp
    • requires gatsby-transformer-sharp
    • if these plugins aren't available, no image processing will be done
  • Converts markdown columns into markdown compatible gatsby nodes
  • Recursively builds child nodes for relational data. - Many to One relations - Many to Many relations
  • Properly handles toggle ui elements from gatsby to transform them into boolean values

Installation

npm install --save gatsby-directus

Configuration

Add gatsby-directus to the plugins in gatsby-config.js

Example:

module.exports = {
  siteMetadata: {
    title: 'Gatsby Default Starter',
  },
  plugins: [
    {
      resolve: `gatsby-directus`,
      options: {
        url: `https://api.mydirectusdomain.com`,
        accessToken: `AKDJFKDJ@#@#@`,
        advancedImageProcessingEnabled: false 
      }
    },
    'gatsby-plugin-react-helmet'
  ],
};

Image Processing

This plugin processes directus images into image sharp compatible nodes as long as gatsby-image is installed, however, you may get issues if you don't have gatsby-plugin-sharp and gatsby-transformer-sharp installed as well.

It does this by downloading the images into .cache/directus.

npm install --save gatsby-image gatsby-plugin-sharp gatsby-transformer-sharp

Additionally, in order to transform gatsby image nodes we need to pass in an option to gatsby-directus telling it to include those transformers.

Example Config:

module.exports = {
  siteMetadata: {
    title: 'Gatsby Default Starter',
  },
  plugins: [
    {
      resolve: `gatsby-directus`,
      options: {
        url: `https://api.mydirectusdomain.com`,
        accessToken: `AKDJFKDJ@#@#@`,
        advancedImageProcessingEnabled: true
      }
    },
    'gatsby-plugin-sharp',
    'gatsby-transformer-sharp',
    'gatsby-plugin-react-helmet'
  ],
};
0.0.13

5 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago