Back to blog
Blog

New Gatsby source plugin

Cosmic's avatar

Cosmic

March 07, 2023

cover image

We are excited to announce the release of our new Gatsby source plugin. Rebuilt from the ground up, the new plugin makes use of new features and best practices with Gatsby and the Cosmic API.

Changes include:

  • Plug and play setup. The source plugin is now able to automatically detect Object types to fetch from Cosmic
  • Improved Object query configuration
    • You can now configure how the source plugin fetches Objects from Cosmic
    • Individual plugin options include:
      • Cosmic API queries
      • Individual props to return
      • Limit per fetch (useful for large or deeply nested Objects)
      • Sort options
      • Publishing status
    • Improved image querying
      • Image Metafields can now be queried like Gatsby images within your Cosmic Objects without the need to download every image during build which will speed up build time
      • Fixed issue with not being able to use Gatsby image queries on deeply nested images
      • Added support for dominant color and base64image placeholder values
  • Other improvements
    • Added configuration validation via the pluginOptionsSchema API
    • Improved logging and error handling

Important notes:

  • This new plugin is only compatible with Gatsby v3 and above.

How to install:

To update to the new plugin run the following command in your Gatsby app:

npm install --save @cosmicjs/gatsby-source-cosmic

Go to the Cosmic Gatsby source plugin on NPM to learn how to get started.