How to conditionally skip rendering a page with App Router and generateStaticParams
Unanswered
Large garden bumble bee posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Large garden bumble beeOP
Hey!
As per the title, how do I conditionally skip out of statically rendering a page based on a build-time environment variable in NextJS? See the screenshot attached for a rough example of what I'm trying to accomplish.
I've tried it with
I understood previously this could've been achieved with using
As per the title, how do I conditionally skip out of statically rendering a page based on a build-time environment variable in NextJS? See the screenshot attached for a rough example of what I'm trying to accomplish.
I've tried it with
dynamicParams: false
and returning an empty array, but that just throws an exception on build-time: Page is missing "generateStaticParams()" so it cannot be used with "output: export" config.
I understood previously this could've been achieved with using
exportPathMap
(https://nextjs.org/docs/app/api-reference/next-config-js/exportPathMap) but that's been deprecated. Is there a new/better way of doing this or should I still give it a shot? Thanks for the assistance!![Image](https://cdn.discordapp.com/attachments/1171033133542539384/1171033133785813012/image.png?ex=655b3497&is=6548bf97&hm=9e5dba7d634584f2a9eede615068b723223dab45693c367166470a6469059137&)