generateStaticParams with [locale]
Unanswered
Ts.Dimitrov posted this in #help-forum
Hello. So, im testing this in 2 apps, in my test app which is without [locale] and next-intl im having this
export async function generateStaticParams() {
const categories = await getCategories();
return categories.items.map((category: any) => ({
category: category.name.toLowerCase(),
}));
}
so when i go to /categories page i see all the [category] params being downloaded immediately, and when i click on 1 of them, its not being downloaded.
But, in my main app, i have [locale] folder with next-intl, its placed below app folder. I have this code
export async function generateStaticParams() {
const locales = ['en', 'bg'];
const params: { locale: string; category: string }[] = [];
for (const locale of locales) {
const categories = await getCategories(locale);
for (const category of categories.items) {
params.push({
locale,
category: category.name.toLowerCase(),
});
}
}
return params;
}
Here the problem is that when i go to /categories page, i dont see all params being downloaded and when i go to one of them, its being downloaded. However, i see all the paths generated properly in the build map, however, its not working.
Anyone that had similar issue and can help? Most likely the problem is coming with the next-intl [locale] folder?
export async function generateStaticParams() {
const categories = await getCategories();
return categories.items.map((category: any) => ({
category: category.name.toLowerCase(),
}));
}
so when i go to /categories page i see all the [category] params being downloaded immediately, and when i click on 1 of them, its not being downloaded.
But, in my main app, i have [locale] folder with next-intl, its placed below app folder. I have this code
export async function generateStaticParams() {
const locales = ['en', 'bg'];
const params: { locale: string; category: string }[] = [];
for (const locale of locales) {
const categories = await getCategories(locale);
for (const category of categories.items) {
params.push({
locale,
category: category.name.toLowerCase(),
});
}
}
return params;
}
Here the problem is that when i go to /categories page, i dont see all params being downloaded and when i go to one of them, its being downloaded. However, i see all the paths generated properly in the build map, however, its not working.
Anyone that had similar issue and can help? Most likely the problem is coming with the next-intl [locale] folder?