1×
Become a member
to unlock all features
Autoplay

    Install MDX in a New Gatsby Project

    Chris BiscardiChris Biscardi
    gatsbyGatsby
    reactReact

    Gatsby and MDX make a great pairing. Here's how to set up a new project with gatsby-mdx to write pages and other content using MDX.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    Instructor: 00:00 First we'll initialize a new Gatsby project using the default starter. Then we'll install gatsby-mdx and its dependencies, mdx-js/mdx and mdx-js/react. With mdx installed, we'll open our project. We need to modify the gatsbyconfig.js file to add the Gatsby mdx plug-in. Now we can run our project.

    00:39 Once we've run our project, we can take the localhost URL and put it into our browser. Finally, we'll create a new page using an mdx to show that gatsby-mdx and mdx.js are working. Gatsby-mdx includes default support for source pages if we include a file with a .mdx extension. Now the site is rebuilt, we'll go to page 3. This is our mdx file.

    Discuss

    Discuss