mccrodp / gatsby-starter-transformer-remark-i18n

Gatsby Markdown Blog using MarkdownRemark and i18n plugins
https://gatsby-starter-transformer-remark-i18n.netlify.com
MIT License
6 stars 8 forks source link

Cannot query field "langKey" #4

Open joaorsfonseca opened 5 years ago

joaorsfonseca commented 5 years ago

GraphQLError: Cannot query field "langKey" on type "MarkdownRemarkFields".

I'm trying to use gatsby-plugin-i18n with gatsby-transformer-remark but i'm getting the error above.

    {
      resolve: 'gatsby-plugin-i18n',
      options: {        
        langKeyDefault: languages.defaultLangKey,
        useLangKeyLayout: false, 
        // prefixDefault: true,
        markdownRemark: {
          postPage: 'src/templates/kb-post.js',
          query: `
          {
              allMarkdownRemark {
                  edges {
                  node {
                      fields {
                      slug,
                      langKey
                      }
                  }
                  }
              }
          }
          `
        }
      }
    },

My folder structure looks like this: |-- contents |---|-- network |---|-- projects |---|---|-- open-project.en.md |---|---|-- open-project.en.pt |-- src |---|-- component |---|-- templates |---|---|-- kb-post.js |-- gatsby-config.js

Any tips? Code available here

Thanks.

mccrodp commented 5 years ago

Looks like you're using Gatsby v2. This starter only got to Gatsby v1. There are a few changes in v2 and I never needed this starter, so never upgraded. I suggest to start from the v2 starter: https://github.com/angeloocana/gatsby-plugin-i18n/tree/master/packages/gatsby-starter-default-i18n

If you want to reference another one that was upgraded, I upgraded this one with Contentful CMS, so it might point you in the right direction also: https://github.com/mccrodp/gatsby-starter-contentful-i18n