Skip to content

Commit

Permalink
Update Readme with information for multiple spaces (#21740)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
4 people authored Mar 10, 2020
1 parent 7090e58 commit 94247c1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/gatsby-source-contentful/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,5 +392,31 @@ documentToReactComponents(node.bodyRichText.json, options)

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

## Sourcing From Multiple Contentful Spaces

To source from multiple Contentful environments/spaces, add another configuration for `gatsby-source-contentful` in `gatsby-config.js`:

```
// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-source-contentful`,
options: {
spaceId: `your_space_id`,
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
},
},
{
resolve: `gatsby-source-contentful`,
options: {
spaceId: `your_second_space_id`,
accessToken: process.env.SECONDARY_CONTENTFUL_ACCESS_TOKEN,
},
}
],
}
```

[dotenv]: https://github.com/motdotla/dotenv
[envvars]: https://gatsby.dev/env-vars

0 comments on commit 94247c1

Please sign in to comment.