#Static site generation
14 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
The route should be statically generated by default unless you use dynamic function(s).
You can also statically export your site if you want a completely static site. This does come with some repercussions however:
https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features
i want middleware to work if any one type wrong url i want to redirect in this case that will not work
so what do you want?
for example i have a array [1, 2, 3]
I'm prerendering them as
/[number]/page.tsx this page is statically generated on build time
also i have a side nav where I'm showing the available /[number] pages so user can navigate. form my nav component I'm fetching the [number] array form my server but the thing is my pages are prepared so i know they will never change without new build so it will be helpful for me if i can make nav component prerender (statically generated)
then here's come next point when someone try to access my website index page there is no index page so I'm rewrite the request to send user to one of the [number] page so that's why I want middleware to work, also there is auto url heal feature when someone type one of the [number] page url but not correct url the url direct them to correct page
Thing is, they should automatically be statically generated by default unless you use a dynamic function in them(or in its layout).
You can try building and checking to see if they are statically generated or not, using the entire list it provides of all dynamic and static pages
If you are using dynamic route then you can do this:
Another solution which you shouldn't need(read above) is exporting dynamic variable with force-static
https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic
this one seems helpful
let me try