Next.js Discord

Discord Forum

routes add up, home/pages/pages/about

Unanswered
Beveren posted this in #help-forum
Open in Discord
BeverenOP
I have my pages dir, and then I’ll have my pages defined in a folder that’s their name

So
folder: pages /
folder : testpage then page.tsx

I’ll have the <Link href=“pages/testpage” />


But tho, when on on a page, and I’ll click on link to go to about page, products page and others…. It adds on “pages” to the route
It then says “can’t find” because the rote turns into:
“pages/pages/pages/about/pages”


What causes that?

7 Replies

If I had to guess
Just spitballing here
But the folder names "app" and "pages" might be reserved by Next.js, I saw someone with an issue earlier where they had an app folder in their app folder
Oh, and also, do you have a root layout? I can't tell
Actually, can you clarify if your intention is to use the app router or the pages router in general? I can't nail down exactly what you're trying to do here, I assume you're trying to use the app router with a route called /pages
BeverenOP
I’m using the pages router,
I’ve been told over and over that to create a SRC, App and Pages,

When I tried to delet the App folder, it errored, when I moved the Pages to the same level as App, it errored.
The /PageName didn’t work, other then the above
If you could throw a basic example on github I could probably take a better look 🙏