T
TanStack12mo ago
passive-yellow

advice on filesystem routing

is there a way to achieve this posts structure from the docs without having both a directory named posts and a posts.tsx ideally I could have something like posts/ with a layout.tsx and then also index.tsx and $postId.tsx. not having everything post-related contained within the posts directory itslef feels confusing to me.
No description
2 Replies
like-gold
like-gold12mo ago
instead of
posts.tsx
posts/
index.tsx
$postId.tsx
posts.tsx
posts/
index.tsx
$postId.tsx
you can have
posts/
route.tsx // <<<< this is the "route" token (can be changed via config)
index.tsx
$postId.tsx
posts/
route.tsx // <<<< this is the "route" token (can be changed via config)
index.tsx
$postId.tsx
passive-yellow
passive-yellowOP12mo ago
oh thats exactly what i wanted, thank you!

Did you find this page helpful?