gatsby-source-strapi-plugin-navigation-v2
v1.0.2
Published
Gatsby source plugin to fetch and expose the Navigations as GraphQL nodes in Gatsby from Strapi using the strapi-plugin-navigation API.
Downloads
27
Maintainers
Readme
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.
Credits
Heavily inspired by edardev's sourcing plugin.