What if I want a layout route named “`index`”?
If the file
posts.index.tsx
has been made to mean /posts/
and not /posts/index
then how can layout route /posts/index
be accomplished? Can this be done without changing the indexToken
config option away from “index
”?
* posts.index.tsx
-> /posts/
* posts.[index].tsx
-> /posts/[index]
* posts.index.route.tsx
-> /posts/
* posts.index.index.tsx
-> /posts/index/
* posts.index.index.route.tsx
-> /posts/index/
* ??? -> /posts/index
?10 Replies
other-emerald•2w ago
did escaping with
[]
not work?optimistic-goldOP•2w ago
The
[]
escaping seems to only be for escaping dots? I also don’t really like how the dot is representing a file path separator (looks like multiple extensions) in supporting flat file structures. I’m only a few pages into TSR, and it’s already triggering my OCD.other-emerald•2w ago
then dont use the dot?
and use nested files / folders
The [] escaping seems to only be for escaping dots?did you try it?
optimistic-goldOP•2w ago
posts[.]index.tsx
gives /posts.index
If that's what you mean to try?other-emerald•2w ago
no i meant [index].tsx
but doesnt seem to work
optimistic-goldOP•2w ago
It looks like
[]
escaping is ignored for anything that isn’t a single character:
water.tsx
-> /water
wa[t]er.tsx
-> /water
wa[te]r.tsx
-> /wa[te]r
wa[]ter.tsx
-> /wa[]ter
other-emerald•2w ago
so yes in fact the escaping does not work to escape against index being treated as index
i am not sure if we want to support that, but can you please create a github issue for this including a forked stackblitz example?
optimistic-goldOP•2w ago
Okay
other-emerald•2w ago
have a fix for the single char escaping lined up
but this does not affect index being treated as literal "index"
optimistic-goldOP•2w ago
GitHub
Creating a layout route named “
index
” is not supported by fil...Which project does this relate to? Router Describe the bug According to the file-based routing rules, a file named posts.index.tsx means /posts/ and not /posts/index. So then how can layout route /...