what is the proper way to enable SSG and ISR?
Unanswered
Siberian Husky posted this in #help-forum
Siberian HuskyOP
hi
I have s problem with SSG that does not works with specific routes.
In this example I have the blog-post route, it must generates SSG at build time, this page have next-intl to localize and get api requests.
you can see the blog-posts/[slug]/page.tsx on the following link:
https://github.com/sfwnisme/frontend-real-estate/blob/feat/site-info/app/%5Blocale%5D/(client)/(pages)/blog-posts/%5Bslug%5D/page.tsx
the purpoes of this page:
- generated as SSG without any issue
- enables the ISR to refresh the data if changes happened on the page
the problem:
I have to use ‘export const dynamic = “force-static”’ and ‘export const invalidate = 60’
, so I can enable the SSG generating.
Conclusion:
I need to know the right way to do SSG. and ISR and I think I am doing a wrong thing with the requests functions or the next-intl
I have s problem with SSG that does not works with specific routes.
In this example I have the blog-post route, it must generates SSG at build time, this page have next-intl to localize and get api requests.
you can see the blog-posts/[slug]/page.tsx on the following link:
https://github.com/sfwnisme/frontend-real-estate/blob/feat/site-info/app/%5Blocale%5D/(client)/(pages)/blog-posts/%5Bslug%5D/page.tsx
the purpoes of this page:
- generated as SSG without any issue
- enables the ISR to refresh the data if changes happened on the page
the problem:
I have to use ‘export const dynamic = “force-static”’ and ‘export const invalidate = 60’
, so I can enable the SSG generating.
Conclusion:
I need to know the right way to do SSG. and ISR and I think I am doing a wrong thing with the requests functions or the next-intl
4 Replies
@Siberian Husky hi
I have s problem with SSG that does not works with specific routes.
In this example I have the blog-post route, it must generates SSG at build time, this page have next-intl to localize and get api requests.
you can see the blog-posts/[slug]/page.tsx on the following link:
https://github.com/sfwnisme/frontend-real-estate/blob/feat/site-info/app/%5Blocale%5D/(client)/(pages)/blog-posts/%5Bslug%5D/page.tsx
the purpoes of this page:
- generated as SSG without any issue
- enables the ISR to refresh the data if changes happened on the page
the problem:
I have to use ‘export const dynamic = “force-static”’ and ‘export const invalidate = 60’
, so I can enable the SSG generating.
Conclusion:
I need to know the right way to do SSG. and ISR and I think I am doing a wrong thing with the requests functions or the next-intl
it's impossible ([read here](https://discord.com/channels/752553802359505017/1484525271393632296/1484525271393632296)). What you can do is to use cacheComponents and then revalidate a specific tag. Like that you force the ISR to regenerate and like that you got the new version up and running
@B33fb0n3 it's impossible ([read here](https://discord.com/channels/752553802359505017/1484525271393632296/1484525271393632296)). What you can do is to use cacheComponents and then revalidate a specific tag. Like that you force the ISR to regenerate and like that you got the new version up and running
I dont see he is using search params seem to be using params.
@Siberian Husky hi
I have s problem with SSG that does not works with specific routes.
In this example I have the blog-post route, it must generates SSG at build time, this page have next-intl to localize and get api requests.
you can see the blog-posts/[slug]/page.tsx on the following link:
https://github.com/sfwnisme/frontend-real-estate/blob/feat/site-info/app/%5Blocale%5D/(client)/(pages)/blog-posts/%5Bslug%5D/page.tsx
the purpoes of this page:
- generated as SSG without any issue
- enables the ISR to refresh the data if changes happened on the page
the problem:
I have to use ‘export const dynamic = “force-static”’ and ‘export const invalidate = 60’
, so I can enable the SSG generating.
Conclusion:
I need to know the right way to do SSG. and ISR and I think I am doing a wrong thing with the requests functions or the next-intl
that should be cacheable i dont see any reason to that be dynamic have you some dynamic source in some layout like making auth on layout or something like that?
also that line is not needed at all [] is an array of length 0 so your code is kinda if x=a return a. I had used next-intl and it always generate StaticParams without problems.