Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

GitHub license demo npm gatsby bludit

gatsby-source-bludit

Description

This Gatsby Source plugin allows you to pull in data from your Bludit site via the Bludit API.

Dependencies

  • node-fetch

How to install

npm install gatsby-source-bludit

Examples of what to add to your gatsby-config.js in the plugins array:

    {
      resolve: `gatsby-source-bludit`,
      options: {
        url: "https://<YOUR-BLUDIT-URL>/api/pages",
        token: process.env.GATSBY_BLUDIT_TOKEN,
        numberOfItems: "10", // Only available on the /api/pages endpoint
        rootKey: "BluditPages"
      },
    },
    {
      resolve: `gatsby-source-bludit`,
      options: {
        url: "https://<YOUR-BLUDIT-URL>/api/categories",
        token: process.env.GATSBY_BLUDIT_TOKEN,
        rootKey: "BluditCategories"
      },
    },
  • The example above shows setting two endpoints for usage.
  • The examples above are using an environment variable to include the Bludit Token securely. Learn More

Options

Name Type Description
url string Required Url of your API endpoint.
token string Required API Token.
rootKey string Required Name the endpoint.
numberOfItems string Optional Number of items to return. Only used for the /api/pages endpoint. Default is set to return all.

How to query for data

export const query = graphql`
  {
    allBluditPages {
      edges {
        node {
          id
          coverImage
          title
          permalink
          slug
        }
      }
    }
  }
`;

Be sure to set the allBluditPages above to use the rootKey that you set for the endpoint.

How to contribute

Any contribution, feedback, and PRs are very welcome. Issues is the preferred method of submitting feedback.

© 2023 Gatsby, Inc.