Next.js Discord

Discord Forum

Equivalent to route groups for an explicit segment + a dynamic segment

Unanswered
Eric Burel posted this in #help-forum
Open in Discord
Say I have [lang]/home/page.tsx and fr/mon-article/page.tsx, meaning that the URL "/fr/mon-article" exists only in French, but "/en/home" and "/fr/home" hit the generic "[lang]" route
How can I share a layout efficiently between both? I think I need to create a separate component,but repeat the layout.tsx file in both [lang] and fr folders?

4 Replies

Plott Hound
sorry Eric, i didnt fully read your question. i'll try it out in a demo project
I've ended up crafting a reusable component that I import in 2 layout files
I don't think we can do any better because anything more automated than that would be problematic if you actually want 2 different layouts