Skip to content

Commit 94247c1

Browse files
alex-tgkLBKhaledgarbayagatsbybot
authoredMar 10, 2020
Update Readme with information for multiple spaces (#21740)
* Update Readme with information for multiple spaces Added in an explanation for sourcing from multiple Contentful environments/spaces. This is a topic I have seen come up multiple times in the community so I thought it warranted adding it here. * Update README.md * Update packages/gatsby-source-contentful/README.md Co-Authored-By: LB <laurie@gatsbyjs.com> * Update packages/gatsby-source-contentful/README.md Co-Authored-By: Khaled Garbaya <khaledgarbaya@gmail.com> * chore: format * Update README.md Added ` to gatsby-config.js Co-authored-by: LB <laurie@gatsbyjs.com> Co-authored-by: Khaled Garbaya <khaledgarbaya@gmail.com> Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
1 parent 7090e58 commit 94247c1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
 

‎packages/gatsby-source-contentful/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -392,5 +392,31 @@ documentToReactComponents(node.bodyRichText.json, options)
392392

393393
Check out the examples at [@contentful/rich-text-react-renderer](https://github.com/contentful/rich-text/tree/master/packages/rich-text-react-renderer).
394394

395+
## Sourcing From Multiple Contentful Spaces
396+
397+
To source from multiple Contentful environments/spaces, add another configuration for `gatsby-source-contentful` in `gatsby-config.js`:
398+
399+
```
400+
// In your gatsby-config.js
401+
module.exports = {
402+
plugins: [
403+
{
404+
resolve: `gatsby-source-contentful`,
405+
options: {
406+
spaceId: `your_space_id`,
407+
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
408+
},
409+
},
410+
{
411+
resolve: `gatsby-source-contentful`,
412+
options: {
413+
spaceId: `your_second_space_id`,
414+
accessToken: process.env.SECONDARY_CONTENTFUL_ACCESS_TOKEN,
415+
},
416+
}
417+
],
418+
}
419+
```
420+
395421
[dotenv]: https://github.com/motdotla/dotenv
396422
[envvars]: https://gatsby.dev/env-vars

0 commit comments

Comments
 (0)
Please sign in to comment.