DEV Community

Discussion on: Gatsby and Netlify CMS: First Impressions

Collapse
 
abeeken profile image
Andrew Beeken

Hi Brian, thanks for this article! I'm just getting into Gatsby and Netlify myself with the aim of broadening my understanding of Jamstack - I've been fiddling with websites for 15 years now so it feels great to be working with something that's just building flat, fast pages again after over a decade of wrangling Wordpress!

I'm finding all the issues you did, however, and my current headache is the dreaded "xyz" must not have a selection... on the featured images I'm setting in the CMS - did you ever find a concrete way around this? The error is so vague and I've spent a couple of days now trying different solutions, cleaning my Gatsby cache and reading the same few articles on this over and over again! It's a real black spot on what is an excellent approach to site building and content management.

Collapse
 
bbarbour profile image
Brian Barbour

I did end up fixing it, but it's been literal months since I worked on the project and forgot the exact details of what I did to fix it.

However, I will provide you my gatsby-config.js file and maybe that can help?

module.exports = {
  siteMetadata: {
    title: '',
    description: '',
  },
  plugins: [
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: `assets`,
        path: `${__dirname}/static/assets`,
      },
    },
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-plugin-netlify-cms-paths`,
            options: {
              cmsConfig: `/static/admin/config.yml`,
            },
          },
          {
            resolve: `gatsby-remark-relative-images`,
            option: {
              name: `assets`,
            },
          },
          {
            resolve: "gatsby-remark-images",
            options: {},
          },
        ],
      },
    },
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: "chapters",
        path: `${__dirname}/content/chapters`,
      },
    },
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: "pages",
        path: `${__dirname}/content/pages`,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: "posts",
        path: `${__dirname}/content/posts`,
      },
    },
    "gatsby-plugin-sharp",
    "gatsby-transformer-sharp",
    `gatsby-plugin-react-helmet`,
    `gatsby-plugin-netlify-cms`,
    "gatsby-plugin-netlify",
  ],
}```

Collapse
 
abeeken profile image
Andrew Beeken

Thank you so much! Unfortunately rejigging this hasn't helped so I feel that the problem is likely elsewhere, either in the frontmatter itself or how I'm building the pages. Ah well, I'm sure I'll reach a conclusion eventually!

Thread Thread
 
bbarbour profile image
Brian Barbour

One thing I do remember clearly is needing to have all the fields in the frontmatter be there, or it would get weird.