JavaScript for WordPress Forums Gatsby Gatsby Basics: gatsby-mdx is depreciated, use gatsby-plugin-mdx instead

This topic contains 2 replies, has 3 voices, and was last updated by  Alex Fornuto 3 weeks, 6 days ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #117588


    Hi Zac,

    Unfortunately your video on the Gatsby Basics course Creating Content with Markdown (MDX) is now out of date because gatsby-mdx is depreciated.

    I managed to switch to using gatsby-plugin-mdx and it works fine, also the video is a lot longer than 5:03 🙂

    This error also effects the next video Creating Dynamic Page Templates. There is no longer a code object in mdx, only body and when I try to code along as per the instructions I get an error:

    ERROR #85907 GRAPHQL

    There was an error in your GraphQL query:

    – Unknown field ‘code’ on type ‘Mdx’.

    To fix this you have to do:

    query MyQuery($slug: String!) {
    mdx(frontmatter: { slug: { eq: $slug } }) {
    frontmatter {


    export default ({
    data: {
    mdx: {
    frontmatter: { title },
    body: content,
    }) => (

    Now I get the post body showing 🙂

    • This topic was modified 1 week, 6 days ago by  Zac Gordon.

    Zac Gordon

    Thanks for the ping! Actually update this in a later video, but will link to this from the video!


    Alex Fornuto

    Related, when I got to Adding React Components to MDC Files, I was unable to load the Shoutout component from within the markdown file. To resolve:

    1. Go to posts.js and add:
      import { MDXProvider } from "@mdx-js/react"
      import Shoutout from "../components/shoutout"
      const shortcodes = {
    2. And where you import the content, adjust to:
              <MDXProvider components={shortcodes}>
    3. Now in your markdown file, you can use <Shoutout> tags without importing.

    I hope this helps others.

    • This reply was modified 3 weeks, 6 days ago by  Alex Fornuto. Reason: Adjust formatting
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.