Next.js + Cloudflare Pages: The Perfect SEO Combo
Why Next.js static export on Cloudflare Pages delivers Lighthouse scores >95 and unbeatable SEO.
SEO in 2026 rests on three pillars: speed, content, and technical structure. Next.js combined with Cloudflare Pages excels on all three.
Why Static Export?
Next.js offers several rendering modes. Static export (`output: 'export'`) generates pure HTML files, without a Node.js server. The SEO advantages:
- TTFB < 50ms: files are served from Cloudflare's CDN, milliseconds from every visitor
- Lighthouse >95: no blocking JavaScript, instant rendering
- Zero cost: Cloudflare Pages offers free hosting with unlimited bandwidth
- 99.99% reliability: no server downtime, no scaling to manage
Optimal Configuration
next.config.ts
The key configuration for a performant static site:
- `output: 'export'` for static generation
- `trailingSlash: true` for Cloudflare compatibility
- `images: { unoptimized: true }` since image optimization requires a server
Security Headers
Cloudflare allows adding headers via a `_headers` file:
- `X-Frame-Options: DENY` against clickjacking
- `X-Content-Type-Options: nosniff` against MIME sniffing
- `Strict-Transport-Security` to enforce HTTPS
- Long cache on fonts and static assets
i18n Without Middleware
With static export, Next.js middleware is not available. The solution: `next-intl` with `generateStaticParams` that pre-generates all pages in all languages.
Each URL has its locale version: `/fr/`, `/en/`, `/th/`. The hreflang tags in metadata ensure Google indexes the right version for each audience.
Structured Data (JSON-LD)
Add JSON-LD for Google rich results:
- `Organization` for the homepage
- `FAQPage` for pages with FAQ
- `BlogPosting` for articles
- `BreadcrumbList` for navigation
Conclusion
Next.js + Cloudflare Pages is the most performant combo for a showcase site in 2026. Zero server, zero cost, perfect Lighthouse scores, and flawless technical SEO.