Skip to Content
🚧 This is WIP documentation for Nextra 4.0. Dima Machina is looking for a new job or consulting.

src Directory

As an alternative to having the special Nextra content directory and mdx-components file in the root of your project, Nextra also supports the common pattern of placing application code under the src directory.

This separates application code from project configuration files which mostly live in the root of a project, which is preferred by some individuals and teams.

To use the src directory, move the content directory and mdx-components file to src/content or src/mdx-components respectively.

    Without src directory

        • page.jsx
      • layout.jsx
      • index.mdx
    • mdx-components.js
    • next.config.js
    • package.json

    With src directory

          • page.jsx
        • layout.jsx
        • index.mdx
      • mdx-components.js
    • next.config.js
    • package.json
Last updated on