Question about Documentation on "Dynamic segments without generateStaticParams"
Answered
Northeast Congo Lion posted this in #help-forum
Northeast Congo LionOP
I'm new to Next.js (loving it so far) and as I was reading through the docs, I came across the following section: https://nextjs.org/docs/app/getting-started/linking-and-navigating#dynamic-segments-without-generatestaticparams
My question is, if anybody else thinks that the example they've provided does not really make sense for the dynamic page? Why would one want to load all the posts in
My question is, if anybody else thinks that the example they've provided does not really make sense for the dynamic page? Why would one want to load all the posts in
generateStaticParams
if the page is (probably) going to render a single blog post?Answered by chisto
on this example yes, you would need to rebuild to see the changes
there's also another strategy called ISR
https://nextjs.org/docs/app/guides/incremental-static-regeneration
which lets you revalidate time-based or on demand, which combine the best of the 2 worlds, it can be static and u can choose when to revalidate the info, this is used more for e-commerce product pages, news articles, or if your blogs update frequently
there's also another strategy called ISR
https://nextjs.org/docs/app/guides/incremental-static-regeneration
which lets you revalidate time-based or on demand, which combine the best of the 2 worlds, it can be static and u can choose when to revalidate the info, this is used more for e-commerce product pages, news articles, or if your blogs update frequently
4 Replies
if you don't use generateStaticParams, the page will indeed be dynamic generated on every visit (SSR)
the main goal of generateStaticParams is that you give to nextjs all the possible different posts ahead of time, so he can static build the pages when compile (SSG)
if the page is static, it loads faster, you wont hit the backend on every visit, its good for blogs, marketing sites, documentations, things that you don't need to be dynamic or won't change much
the main goal of generateStaticParams is that you give to nextjs all the possible different posts ahead of time, so he can static build the pages when compile (SSG)
if the page is static, it loads faster, you wont hit the backend on every visit, its good for blogs, marketing sites, documentations, things that you don't need to be dynamic or won't change much
Northeast Congo LionOP
I see thank you for your reply @chisto
So do I understand correctly, that if the content of a blog changes, I would need to rerun the build process if I decided to use
So do I understand correctly, that if the content of a blog changes, I would need to rerun the build process if I decided to use
generateStaticParams
?on this example yes, you would need to rebuild to see the changes
there's also another strategy called ISR
https://nextjs.org/docs/app/guides/incremental-static-regeneration
which lets you revalidate time-based or on demand, which combine the best of the 2 worlds, it can be static and u can choose when to revalidate the info, this is used more for e-commerce product pages, news articles, or if your blogs update frequently
there's also another strategy called ISR
https://nextjs.org/docs/app/guides/incremental-static-regeneration
which lets you revalidate time-based or on demand, which combine the best of the 2 worlds, it can be static and u can choose when to revalidate the info, this is used more for e-commerce product pages, news articles, or if your blogs update frequently
Answer
Northeast Congo LionOP
awesome! Thank you so much for your expertise @chisto