decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.89k stars 3.04k forks source link

Field "logo" must not have a selection since type "String" has no subfields. #2376

Closed engmagdy87 closed 5 years ago

engmagdy87 commented 5 years ago

I'm tying to query uploaded image using graphql in gatsby, but the query fails Field "logo" must not have a selection since type "String" has no subfields.

this is gatsby-config.js gist

this is config.yml gist

and this is md file


section: partners title: bolt logo: /uploads/logo.png

and this is the query

query PartnersQuery {
  allMarkdownRemark(filter: {frontmatter: {section: {eq: "partners"}}}) {
    edges {
      node {
        id
        frontmatter {
          title
          logo {
              childImageSharp {
                fluid(maxWidth: 700) {
                  srcSet
                  sizes
                  aspectRatio
                  src
                }
              }
            }
        }
      }
    }
  }
}
engmagdy87 commented 5 years ago

solved by adding this snippet to gatsby-node.js

const { fmImagesToRelative } = require('gatsby-remark-relative-images');

exports.onCreateNode = ({ node }) => {
    fmImagesToRelative(node);
};