Gatsby source plugin to fetch and expose the Navigations as GraphQL nodes in Gatsby from Strapi using the strapi-plugin-navigation API.
npm install gatsby-source-strapi-plugin-navigation-v2This plugin sources the strapi-plugin-navigation.
yarn:
``bash`
yarn add gatsby-source-strapi-plugin-navigation-v2`
npm:bash`
npm install gatsby-source-strapi-plugin-navigation-v2
js
// 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.
`js
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