Creating source plugins
As we mentioned in the Understanding Gatsby plugins section, source plugins are those that allow us to ingest data from a new source into our GraphQL layer. By creating a source plugin, we abstract the logic to source this data away from our site so that we can reuse it across multiple Gatsby projects if we want to. To understand how source plugins work, let's build one together. Let's source our total contributions from GitHub so that we can display them on our about page:
- The first thing we need to be able to do to pull data from GitHub is use an access token. Navigate to https://github.com/settings/tokens/new.
- Write a Note to help you identify your access token later:
- Change the Expiration property to your desired length. Once the length of time has been selected, the token will be deleted and no longer work. If you prefer that it doesn't expire, you can select No Expiry...