Next.js Discord

Discord Forum

How to make dynamic routes at start empty?

Unanswered
British Shorthair posted this in #help-forum
Open in Discord
British ShorthairOP
I have a website with the following structure: [lang]/about which renders:
- /en/about
- /de/about
- /sq/about

However, after completing the whole website I want to change the structure like so:
- /about (English by default)
- /de/about
- /sq/about

NOTE: I also use SSG for this website:
export async function generateStaticParams() {
  return [{ lang: 'en' }, { lang: 'de' }, { lang: 'sq' }]
}

6 Replies

first thought, but could you abuse middleware and rewrites?
Either that ^ or a optional catchall segment (check docs).
Not sure how recommended that would be though, but it can work
see, idk if youd want a catchall
and i haven't tried if you can make an optional dynamic
Optional dynamic?