I'm using this documentation as a reference to extract parameters from the URL in my generateStaticParams function: https://nextjs.org/docs/app/api-reference/functions/generate-static-params#generate-params-from-the-bottom-up
This is the route I am working with:
app/[productType]/[coverType]/[make]/page.tsx
Here's my implementation:
export async function generateStaticParams({
params: { productType, coverType },
}: {
params: { productType: string; coverType: string };
}) {
console.log('GenerateStaticParams:', { productType, coverType });
const makeData = await getAllMakes({
type: productType,
cover: coverType,
});
return makeData.filter(Boolean).map((make) => ({
make: make,
}));
}
Both productType
and coverType
are currently undefined. Is there an issue with my approach? Or could it be because I am not generating the parameters from the top down?