Next.js Discord

Discord Forum

dynamic route converts to index.html on prod

Unanswered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
Hi, im using dynamic routes for my project, on local it is working fine but on prod, when im hitting site/username -> in my search params im getting the value 'index.html' instead of actual username. The flow is working fine on local.

12 Replies

then, next.config.mjs write
output: 'export'
trailingSlash: true (for correct html)
Spectacled bearOP
@American but why it is showing index.html?
@Spectacled bear <@350186302735646721> but why it is showing index.html?
American
dynamic routes doesn't know how many html he should create, so when you write generateStaticParams you will generate static params for every possible html pages. For example you have online store and you dinamic route for every product overview page. generateStatic params resolve it
I'm sorry, I don't know how to better explain it, my bad
Spectacled bearOP
is it required to use this function? I guess the site should work fine even without this function
So params.username is index.html in production? Where are you hosting?
@Spectacled bear is it required to use this function? I guess the site should work fine even without this function
American
export async function gemerateStaticParams(){
fetch(...)
return {
slug: item.id
}
export default function ProductDetail({slug }){

}
@American export async function gemerateStaticParams(){ fetch(...) return { slug: item.id } export default function ProductDetail({slug }){ }
Spectacled bearOP
I can't go for this one as data keeps changing and there are good no of users
Spectacled bearOP
Anyone?