Open Simply007 opened 5 years ago
Note:
I have tested out a 🚩 really HACKY 🚩 thing with the source plugin and it is definitely not recommended to use it like that in production, but registering the plugin twice with different configurations works if the types are two distinct sets.
gatsby.config.js
[
// ...
{
resolve: '@kentico/gatsby-source-kontent',
options: {
projectId: "FIRST_PROJECT", // Fill in your Project ID
languageCodenames: ["default"]
},
},
{
resolve: '@kentico/gatsby-source-kontent',
options: {
projectId: "SECOND_PROJECT", // Fill in your Project ID
languageCodenames: ["default"]
},
}
// ...
]
The only thing is this error
A field extension with the name `kontent_item_language_link` has already been registered.
But this might be another approach to implement it - allow registering source plugin multiple times like i.e. gatsby-source-filesystem
Motivation
Allow users to load data from more than one project.
Proposed solution
Extend a configuration object by the project identification property that would create the project-specific prefix for created Nodes.
Configuration example:
Possible workaround
Using Kontent Delivery API directly (or using JS SDK) without the GraphQL layer might work as a workaround: https://www.gatsbyjs.com/docs/how-to/querying-data/using-gatsby-without-graphql/