Next.js Discord

Discord Forum

how to use dynamic route with root route?

Unanswered
Somali posted this in #help-forum
Open in Discord
SomaliOP
hi,
what i mean:
i wanna delete root page.js file and create
[slug] (dynamic route) forall pages include 'home' page, but page avalable on '/' path

but i cant rewrite path in generateStaticParams
export async function generateStaticParams() {
    const posts = await getPages();

    return posts.map((post) => ({
        slug: post.slug,
    }));
}


how to do that?

0 Replies