Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot query field "langKey" #4

Open
joaorsfonseca opened this issue Sep 3, 2019 · 1 comment
Open

Cannot query field "langKey" #4

joaorsfonseca opened this issue Sep 3, 2019 · 1 comment

Comments

@joaorsfonseca
Copy link

joaorsfonseca commented Sep 3, 2019

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
Copy link
Owner

mccrodp commented Sep 9, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants