Using prefix "_" for folders in pages directory
Unanswered
Alligator mississippiensis posted this in #help-forum
Alligator mississippiensisOP
Next 14 |
If I have a folder in my pages directory that starts with underscore, but insidie it i have filed that don't start with underscore, will they be cosidered routes?
pages
_directory
child-directory
If I have a folder in my pages directory that starts with underscore, but insidie it i have filed that don't start with underscore, will they be cosidered routes?
pages
_directory
child-directory
6 Replies
I dont remember if
pages router has the concept of private folders using underscore. However in app router it makes all subdirectories un-routable.Here are the [docs](https://nextjs.org/docs/app/building-your-application/routing/colocation#private-folders) for the app router
Cant find anything about page router
@Alligator mississippiensis Next 14 |
If I have a folder in my pages directory that starts with underscore, but insidie it i have filed that don't start with underscore, will they be cosidered routes?
pages
_directory
child-directory
Pages router doesn’t have the underscore rule. So yes you will still have /_directory/child-directory.
Put anything that’s not a page (or an api route, or a known special file like _app.js) outside the pages folder.
Put anything that’s not a page (or an api route, or a known special file like _app.js) outside the pages folder.
@joulev Pages router doesn’t have the underscore rule. So yes you will still have /_directory/child-directory.
Put anything that’s not a page (or an api route, or a known special file like _app.js) outside the pages folder.
Alligator mississippiensisOP
There is no other alternative in the pages folder?
thank you!
thank you!
@Alligator mississippiensis There is no other alternative in the pages folder?
thank you!
No afaik. Just put non-route stuff outside the folder