Next.js Discord

Discord Forum

Prerender same page multiple times

Unanswered
Australian Terrier posted this in #help-forum
Open in Discord
Australian TerrierOP
I have an app with some middleware that rewrites reqeusts to the same underlying page. The pathnames
- /page-1
- /page-2
- /page-3
all get rewritten to /page, so src/app/page/page.tsx get's rendered for all three.

I know at build-time which pathnames will cause /page to render. The page will appear differently depending on which pathname is used. Is there a way to statically build the page multiple times without adding a route-parameter?

I know that the middleware would still be needed for routing during production, but there is no reason to actually re-run the render logic for each request since that can all happen at build-time.

0 Replies