Nextra 3.0 is released. Read more
DocumentationGuideStatic Exports

Static Exports

Export your pages statically, and deploy with Nginx, GitHub Pages and more.

Getting Started

Configuration

next.config.mjs
import nextra from 'nextra'
 
/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
  output: 'export',
  images: {
    unoptimized: true // mandatory, otherwise won't export
  }
  // Optional: Change the output directory `out` -> `dist`
  // distDir: "build"
}
const withNextra = nextra({
  theme: 'nextra-theme-docs',
  themeConfig: './theme.config.tsx'
})
 
export default withNextra(nextConfig)

Building

Run the build command according to your package manager:

npm run build

By default, static export will be stored in out directory in the root of your project.

For more in detail documentation for static export visit Next.js docs.