> For the complete documentation index, see [llms.txt](https://openai.gitbook.io/code-cheatsheets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://openai.gitbook.io/code-cheatsheets/react/all/gatsby/packages/mdx.md).

# MDX

```bash
yarn add gatsby-plugin-mdx @mdx-js/mdx @mdx-js/react
yarn add gatsby-source-filesystem # frontmatter, generate Gatsby nodes from local files, and use import/export functionality in our MDX files
```

gatsby-config.js

```javascript
module.exports = {
  //...siteMetadata, etc
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `pages`,
        path: `${__dirname}/src/pages/`,
      },
    },
    {
      resolve: `gatsby-plugin-mdx`,
      options: {
        defaultLayouts: {
          default: require.resolve(`./src/components/Layout`),
        },
      },
    },
    // ... other plugins
  ],
}
```
