Home /

docs

Migrate from Nextra

Nextra and the Farming Labs Next.js adapter both use Next.js and MDX, making this one of the most direct migrations. Most effort goes into replacing Nextra route/layout wiring, _meta navigation, and theme-specific components.

Keep the Next.js application

When the existing Next.js application should remain, initialize Farming Labs Docs inside it and migrate only the docs surface. You do not need to recreate the entire app.

1. Inventory the source

Locate:

  • content/ or src/content/
  • pages/ MDX content
  • app/**/page.mdx content
  • _meta.js, _meta.ts, _meta.jsx, _meta.tsx, or _meta.global.*
  • next.config.* and the nextra(...) wrapper
  • theme.config.*, mdx-components.*, and layout files
  • custom React components, CSS, and public/
  • search, i18n, redirects, and custom Next.js middleware

2. Choose the target shape

For the shortest migration, keep Next.js and use the Farming Labs Next.js adapter:

NextraFarming Labs Next.js
content/foo.mdxapp/docs/foo/page.mdx
app/foo/page.mdxapp/docs/foo/page.mdx, adjusted for the chosen docs base
_meta.*File hierarchy and order frontmatter
Nextra catch-all pageGenerated Farming Labs docs route
theme.config.*docs.config.ts theme, navigation, and page actions
mdx-components.*docs.config.ts components registry
public/**Existing public/**

If you are also changing runtime, move the MDX into that adapter's configured contentDir after first making the content portable.

3. Convert _meta navigation

Nextra _meta files can define order, titles, hidden items, separators, external links, and navbar pages. For each directory:

  1. Preserve the object key order.
  2. Rename or position the matching page.
  3. Add numeric order frontmatter.
  4. Use the configured title as page title when appropriate.
  5. Move display: "hidden" pages outside normal navigation or use supported hidden behavior.
  6. Recreate separators and external links with folder structure or custom sidebar/navigation.

JSX labels and functions inside _meta are application code. Replace them with stable text and registered icons instead of trying to serialize them into frontmatter.

4. Preserve content and routes

Keep portable frontmatter such as title, description, and date fields. Review Nextra-specific fields including asIndexPage, type, display, theme overrides, and layout flags.

When moving from content/foo.mdx to Next.js, the destination is normally:

app/docs/foo/page.mdx

Use a folder page.mdx for section landing pages. Compare the final route with the source before moving on.

5. Convert components

Nextra patternTarget
Nextra <Callout>Farming Labs <Callout>
Nextra <Tabs>Built-in <Tabs> and <Tab>
nextra/components importsBuilt-in or registered local components
useConfig()Static frontmatter or target runtime data
Nextra CardsBuilt-in cards or a local registered component
custom mdx-components mappingdocs.config.ts components

Component names can match while props differ. Remove Nextra imports only after translating their uses and verifying the page.

6. Replace framework wiring

After the migrated docs route builds:

  • remove the Nextra wrapper from next.config.*
  • remove the Nextra catch-all route if it overlaps
  • replace Nextra layout and theme configuration
  • keep unrelated Next.js routes, middleware, fonts, and application providers
  • remove Nextra dependencies only after no imports remain

This order keeps the migration reversible and avoids breaking non-doc pages.

7. Validate and recover

  1. Run the Next.js production build.
  2. Compare the Nextra page map with the Farming Labs sidebar.
  3. Test index pages, hidden pages, external links, imported components, and images.
  4. Verify application routes outside /docs.
  5. Fetch migrated pages with .md.
  6. Remove Nextra dependencies only after all checks pass.

If a route is duplicated, disable one catch-all and retry. If navigation differs, return to the nearest _meta file and translate its key order and special item types explicitly.

Source references

Customize
Live preview on these docs
Reset
Customize
Export Code
Preset
Explore more themes
Primary Color
Primary
Colors
Background
Foreground
Muted Text
Border
Card
Muted BG
Ring
Layout
SidebarBordered
TOC StyleDirectional (tree)
TOC DepthH2 + H3
Ask AI
ModeFloating
Floating StyleFull Modal
PositionBottom Right
Features