英文:
How to name a folder in next js such that it is skipped in the url path?
问题
In my nextjs project, is it possible to ignore or skip a subfolder in the path of the url?
What I mean is, lets say I have a folder structure like this -
src
- app
- page1
- page.tsx
- page2
- page.tsx
- pagegroup (skip this in the url path)
- insidepage1
- page.tsx
- insidepage2
- page.tsx
- insidepage3
- page.tsx
- insidepage1
- page1
I want insidepage to be accessed by url -
/insidepage1
/insidepage2
and not
/pagegroup/insidepage1
Is there a way to name a folder such that it becomes transparent? I did see it somewhere in a youtube tutorial but unfortunately can't remember or find that video now.
英文:
In my nextjs project, is it possible to ignore or skip a subfolder in the path of the url?
What I mean is, lets say I have a folder structure like this -
src
- app
- page1
- page.tsx
- page2
- page.tsx
- pagegroup (skip this in the url path)
- insidepage1
- page.tsx
- insidepage2
- page.tsx
- insidepage3
- page.tsx
i want insidepage to be accessed by url -
/insidepage1
/insidepage2
and not
/pagegroup/insidepage1
Is there a way to name a folder such that it becomes transparent? I did see it somewhere in a youtube tutorial but unfortunately can't remember or find that video now.
答案1
得分: 0
我找到了解决方法。
如果我将文件夹命名为(),它将变为透明。
所以我只需将pagegroup
命名为(pagegroup)
,它就不会包含在URL路径中。
英文:
I found the solution.
If I name the folder in () it will become transparent.
So I can just name pagegroup
to (pagegroup)
and it won't be included in the url path.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论