I'm using the "gatsby-source-prismic-graphql" plugin from Gatsby to connect my Prismic repo with a component and display the blog post data as a card. The query works fine in GraphiQL, but when I implement the GraphQL query into the component Gatsby does not recognize "Prismic" in my query.
Ive tried displaying other data such as site metadata and that is working with no problems
Here is the Git repo: https://github.com/ENEIV/PrometheusIgnis
gatsby-config.js
// Prismic CMS
{
resolve: `gatsby-source-prismic-graphql`,
options: {
repositoryName: `prometheus`,
accessToken: process.env.PRISMIC_KEY,
},
Component querying data from Prismic
import React from "react"
import { RichText } from "prismic-reactjs"
import { StaticQuery, graphql } from "gatsby"
const articlesQuery = graphql`
query {
prismic {
allArticless(uid: "prometheus-prismic-testing-1") {
edges {
node {
article_title
}
}
}
}
}
`
const Posts = () => (
// const doc = data.prismic.allArticless.edges.slice(0, 1).pop()
// if (!doc) return null
<StaticQuery
query={articlesQuery}
render={data => (
<h1>{RichText.render(data.prismic.edges.node.article_title)}</h1>
)}
/>
)
export default Posts