SEO Best Practices
Nextra 3 is built for speed and SEO. Here is how to maximize your site’s visibility.
Static Export
By using output: 'export', Nextra generates static HTML files. This is excellent for SEO because search engine crawlers can easily index your content without needing JavaScript to render.
Metadata
Nextra automatically generates title and meta tags based on your folder structure and file names.
Customizing Meta Tags
You can use the useNextSeoProps hook in your theme.config.tsx to control global SEO settings.
export default {
// ...
useNextSeoProps() {
return {
titleTemplate: '%s – My Brand',
description: 'The official documentation for My Brand.',
openGraph: {
type: 'website',
locale: 'en_US',
url: 'https://my-brand.com',
site_name: 'My Brand',
},
}
},
}Sitemap
Nextra does not automatically generate a sitemap.xml in static export mode by default, but you can use external tools or scripts like next-sitemap to generate one post-build.
For Cloudflare Pages, ensuring your URL structure is clean and you have good internal linking (which Nextra provides automatically via the sidebar) is the most critical first step.