Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-source-strapi-plugin-navigation-v2

This plugin sources the strapi-plugin-navigation.

Install

yarn:

yarn add gatsby-source-strapi-plugin-navigation-v2

npm:

npm install gatsby-source-strapi-plugin-navigation-v2

How to use

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: "gatsby-source-strapi-plugin-navigation-v2",
      options: {
        apiURL: "localhost:1337",
        navigationIdsOrSlugs: [
          "api/navigation/render/1"
        ],
        type: "tree", // optional
        token: "strapi_token" // optional
      }
    }
  ]
}

Alternatively you can use an object with keys that will later map to the navigation items via the key property.

navigationIdsOrSlugs: {
  mainMenu: "api/navigation/render/1"
}

If everything works correctly you should be able to view an allStrapiNavigation option inside GraphiQL.

Example of allStrapiNavigation option in GraphiQL

Credits

Heavily inspired by edardev’s sourcing plugin.

© 2023 Gatsby, Inc.