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
1 Reply
@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