/gatsby-graphcms-example

Example of Gatsby source plugin for GraphCMS

Primary LanguageJavaScriptMIT LicenseMIT

This example is outdated. It uses an old way to connect GraphCMS to Gatsby via the gatsby-source-graphcms plugin. The up to date example can be found here

gatsby-graphcms-example

Example of @GraphCMS/gatsby-source-graphcms

Install

  1. git clone https://github.com/GraphCMS/gatsby-graphcms-example.git && cd gatsby-graphcms-example/
  2. yarn && yarn develop

GraphiQL

For an kitchen sink GraphiQL query you can run on Gatsby’s graphql debugger at http://localhost:8000/___graphql, try this link to preload with gatsby develop running:

Preload kitchen sink GraphiQL query

It puts this in the console:

{
  allArtist {
    edges {
      artist: node {
        id
        name
        slug
        picture {
          id
          handle
          width
          height
        }
        records {
          id
          slug
          title
        }
      }
    }
  }
  allRecord {
    edges {
      record: node {
        id
        slug
        title
        artist {
          id
          slug
          name
        }
        tracks {
          id
          title
          aliasedLength
        }
        cover {
          handle
        }
        reviews {
          id
          slug
          title
        }
      }
    }
  }
  allReview {
    edges {
      review: node {
        id
        slug
        createdAt
        record {
          slug
          title
          artist {
            slug
            name
          }
        }
        title
        review
        rating
        comments {
          body
        }
      }
    }
  }
}

Deploy

Deploy to Netlify

Contributors

and you?

See https://github.com/GraphCMS/gatsby-source-graphcms for more.