Dynamic path does not generate HTML even with getStaticProps
Unanswered
Birman posted this in #help-forum
BirmanOP
Summary
I have some pages being ISR instead of SSG even without
How to force them being SSG and not ISR on build time?
Context
I have a

I realise this might be ISR, but this is the message shown on build:
I don't have
When I visit the

The moment I run
For very specific project reasons, I need all the HTML to be pre-built and not incrementally generated like it's happening right now.
How can I achieve that?
I have some pages being ISR instead of SSG even without
revalidate in getStaticProps.How to force them being SSG and not ISR on build time?
Context
I have a
[...path].tsx file that uses getStaticPaths and getStaticProps. When I run yarn build it even shows me the SSG â— 
I realise this might be ISR, but this is the message shown on build:
â— (SSG) prerendered as static HTML (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)I don't have
revalidate anywhereexport const getStaticPaths: GetStaticPaths = async (context) => {
const cmsPaths = await fetchCmsPaths()
const locales = context.locales || []
const paths = cmsPaths
.filter((path) => path !== "/" && path !== "/404" && path !== "/500")
.map((path) => locales.map((locale) => ({
params: { path: path.split("/").filter(Boolean) },
locale,
})),
).flat()
return { paths, fallback: "blocking" }
}export const getStaticProps: GetStaticProps<ContentPageProps> = async (
context,
) => {
const segments = context.params?.path as string[]
const path = segments.map((segment) => `/${segment}`).join("")
const cmsPage = await fetchCmsPage({ path })
if (!cmsPage) {
return { notFound: true }
}
return { props: { cmsPage } }
}When I visit the
.next/server/pages folder, instead of having the pre-built HTML (like my index.html and others), I have just this:
The moment I run
yarn start and visit one of the pages caught by [...path].tsx file, a HTML magically appears inside the folder.For very specific project reasons, I need all the HTML to be pre-built and not incrementally generated like it's happening right now.
How can I achieve that?
3 Replies
BirmanOP
Latest version. Yep, they weren’t, that’s exactly the question
@Birman Latest version. Yep, they weren’t, that’s exactly the question
could you try something like this and see if the get generated?
//const paths = cmsPaths
// .filter((path) => path !== "/" && path !== "/404" && path !== "/500")
// .map((path) => locales.map((locale) => ({
// params: { path: path.split("/").filter(Boolean) },
// locale,
// })),
// ).flat()
const paths = [
{ params: { path: ["1", "1"] } },
{ params: { path: ["2", "2"] } },
]