Generate static site by multiple dynamic segments using generateStaticParams
Unanswered
Sun bear posted this in #help-forum
Sun bearOP
Next.js guide I followed: https://nextjs.org/docs/app/api-reference/functions/generate-static-params#examples
Let's say I have the following setup:
...
app/[category]/layout.js
app/[category]/[product]/page.js
...
In layout.js I have:
in page.js I have
When I build and export, the
Let's say I have the following setup:
...
app/[category]/layout.js
app/[category]/[product]/page.js
...
In layout.js I have:
export async function generateStaticParams() {
return ['cars', 'boats', 'planes'].map((locale) => ({ category }));
}in page.js I have
export async function generateStaticParams({ params: { category }}) {
return ['1', '2', '3'].map((product) => ({ category, product }));
}When I build and export, the
out directory only shows /out/cars.html, /out/boats.html, and /out/planes.html but I don't see /out/cars/1.html, /out/cars/2.html, /out/cars/3.html and so on.1 Reply
Sun bearOP
here is a demo for reproducing the issue on GitHub using latest Next 13.x
https://github.com/qas/next-13-app-directory-ssg-dynamic-route-bug
https://github.com/qas/next-13-app-directory-ssg-dynamic-route-bug