How to use different layouts for dynamic internationalised routes coming from a headless cms? #65459
Unanswered
rnnyrk
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on a project using a Headless CMS. All pages are fetched dynamically from there so we can use internationalised slugs. This means;
/tickets/buy
/tickets/koop
/accommodations/tents/my-english-slug
/accomodaties/tenten/mijn-nederlandse-slug
Currently we create the pages with
getStaticProps
and render a layout via the pages directory. The setup looks something like this:So currently we do not use any for of build-in optimised NextJS layout handeling like https://nextjs.org/docs/pages/building-your-application/routing/pages-and-layouts#per-page-layouts
We've now started building a new part of the application in App Router and are planning to migrate the whole application in the near future. Therefore we are looking for the best way to setup dynamic internationalised routes combined with the power of layouts in the new app router.
Currently I've created a page with this structure:
app/[site]/[locale]/[...slug]/page.tsx
;This now includes something similar to the first provided example of the pages router.
I thought of maybe using Route Groups: https://nextjs.org/docs/app/building-your-application/routing/route-groups
But how does one dynamic loaded route knows to what group it belongs?
Any suggestion on how to leverage the layouts for dynamic routes in the new app router?
Beta Was this translation helpful? Give feedback.
All reactions