angeloocana / gatsby-plugin-i18n

Multi language routes for Gatsby
435 stars 77 forks source link

GraphQLError: Cannot query field "langKey" on type "MdxFields" #124

Open dandyweng opened 4 years ago

dandyweng commented 4 years ago

Hello,

I'm trying to use this plugin with MDX. I noticed that MDX support was added in #93, but there are no examples provided on how actually to work with MDX files. I assumed this would work:

// gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-plugin-i18n',
    options: {        
      langKeyDefault: 'en',
      useLangKeyLayout: false,
      markdownRemark: {
        postPage: 'src/templates/blog-post.js',
        query: `
          {
            allMdx {
              edges {
                node {
                  fields {
                    slug,
                    langKey
                  }
                }
              }
            }
          }
        `
      }
    }
  }
]

But I got this error message:

"gatsby-plugin-i18n" threw an error while running the createPages lifecycle:

Cannot query field "langKey" on type "MdxFields".

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

Does anyone know the right way of doing this? Thanks

shreyasminocha commented 4 years ago

No new releases of the package have been published to npm since #93. @angeloocana Could you please publish a new release?

bolonio commented 4 years ago

Hi @angeloocana, could you please publish a new release? As @shreyasminocha mentioned, the support for mdx was already merged. Thanks :)