← gitpulse
Bug Fix·Pushed May 9, 2026·XS

Build unblocked for single-page static exports

Sites with only one page of content can now export statically with Next.js 16 — a placeholder param is emitted so the build doesn't fail, while invalid pages still return 404.

Static exports were breaking for sites with minimal content. When a pagination route had only one page, [[code]]generateStaticParams()[[/code]] returned an empty array — a perfectly valid response in normal Next.js, but Next.js 16 with [[code]]output: export[[/code]] rejected it as if the function were missing entirely, causing the build to fail. The fix emits a placeholder parameter [[code]]{ n: '2' }[[/code]] when there are no pages to pre-render. The route handler still short-circuits to [[code]]notFound()[[/code]] for out-of-range pages, so no content leaks — the 404 behavior is preserved, just with a valid static build now. This unblocks static deployment for small blogs, single-release documentation sites, or any project that doesn't need pagination but shares the same route structure. The change applies to both the main content feed and the releases feed in the [[code]]@gitpulse/site[[/code]] app.
Technical description
Two pagination routes in the site were returning empty arrays from [[code]]generateStaticParams[[/code]] when there was only one page of content. Next.js 16 with static export treats this as a missing function, failing the build entirely. The fix adds a fallback that emits [[code]]{ n: '2' }[[/code]] as a placeholder parameter when the params array would be empty. This satisfies Next.js 16's validation without generating real content — the route handler still calls [[code]]notFound()[[/code]] for any out-of-range page number. In [[code ref=1]]site/src/app/page/[n]/page.tsx[[/code]], the loop generates params starting from page 2, so a single-page site produces zero params. The new check handles this case: ````typescript file=site/src/app/page/[n]/page.tsx if (params.length === 0) params.push({ n: '2' }); ```` The same pattern was applied to [[code ref=2]]site/src/app/releases/page/[n]/page.tsx[[/code]] for consistency. The [[code ref=3]]{ n: '2' }[[/code]] placeholder is arbitrary — any valid param works because the route handler immediately calls [[code]]notFound()[[/code]] for any page that doesn't exist. This is purely a build-time artifact to satisfy Next.js 16's stricter validation. **Files at a Glance:** - [[code]]site/src/app/page/[n]/page.tsx[[/code]] — Main feed pagination route, updated to emit placeholder param - [[code]]site/src/app/releases/page/[n]/page.tsx[[/code]] — Releases pagination route, same fix applied

Categories

  • Bug Fix (80%)Fixes a build failure in Next.js 16 static export when pagination has only one page — the build was being rejected due to an empty generateStaticParams return value
  • Maintenance (20%)Enables compatibility with Next.js 16's stricter validation of generateStaticParams in static export mode