Faster Page Loads: Informational Pages Now Statically Generated
Faster Page Loads: Informational Pages Now Statically Generated
Release v0.1.157 · Performance · Build & Deploy
Overview
As of v0.1.157, the /privacy, /terms, and /lawful-basis pages are fully statically generated at build time. This change eliminates redundant server-side rendering for pages that never change between requests, delivering instant responses from the CDN edge.
Background
The Next.js App Router defaults to static generation for any page that has no dynamic data dependencies. However, if a page component explicitly sets force-dynamic — or inadvertently imports a function that opts the route into dynamic rendering (such as auth()) — Next.js will render that page on every incoming request even if the output is always identical.
The /privacy, /terms, and /lawful-basis pages fall into this category: they display fixed legal and compliance copy, contain no personalised content, and require no server-side logic. They were previously being rendered dynamically on every request, adding unnecessary latency and server compute.
What Was Done
- Removed
force-dynamicexports from all three page components, allowing Next.js to apply its default static-generation behaviour. - Audited each component to confirm the absence of
auth()calls or any other dynamic data dependencies that would re-opt the route into server-side rendering. - With no dynamic signals present, the Next.js App Router now pre-renders each page to static HTML at build time.
Performance Impact
| Page | Before | After |
|---|---|---|
/privacy | Dynamic (SSR per request) | Static (pre-rendered at build) |
/terms | Dynamic (SSR per request) | Static (pre-rendered at build) |
/lawful-basis | Dynamic (SSR per request) | Static (pre-rendered at build) |
Statically generated pages are distributed to CDN edge nodes and served with near-zero time-to-first-byte (TTFB), with no application server involved in serving the response.
Developer Notes
When adding or modifying these pages in future:
- Do not add
force-dynamicunless a genuine dynamic data requirement is introduced. - Avoid calling
auth()or any cookies/headers API at the top level of these components — doing so will silently re-enable dynamic rendering. - Run
next buildlocally and inspect the build output to confirm the route is listed as○ (Static)rather thanλ (Dynamic).
# Confirm static generation in the build output
npm run build
# Look for these routes marked with ○ (Static)
# ○ /privacy
# ○ /terms
# ○ /lawful-basis
Related
- Control reference: PERF-19
- Affected file:
src/app/privacy/page.tsx(and equivalentterms,lawful-basispages) - Next.js App Router: Static and Dynamic Rendering