Install MDX in a New Gatsby Project

Chris Biscardi
InstructorChris Biscardi
Share this video with your friends

Social Share Links

Send Tweet
Published 6 years ago
Updated 4 years ago

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.

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.