Image in graphql not have childImageSharp

Viewed 330

I am using strapi to dynamicly serve images. Trying to use the new gatsby-plugin-image but example givin in the documentation is different when i try query my project there is no childImagesharp in my query. AlWhat i am i doing wrong?

The example

query {
 blogPost(id: { eq: $Id }) {
   title
   body
   avatar {
     childImageSharp {
       gatsbyImageData(width: 200)
     }
   }
 }
}

My query

query MyQuery {
  allStrapiProjects {
    nodes {
      title
      image {
        formats {
          medium {
            url
          }
        }
      }
    }
  }
}

1 Answers

You need childImageSharp or localFile nodes (which hold your image data) to display the image.

You should look for something like:

{
  allStrapiProject {
    edges {
      node {
        id
        image {
          publicURL
        }
        multipleImages {
          localFile {
            publicURL
          }
        }
      }
    }
  }
}

Check the possible nodes at localhost:8000/___graphql.

Related