hozana / next-translate-routes

Flexible and translated routes for Next.js without custom server
MIT License
115 stars 30 forks source link

How to work with dynamic routes? #73

Closed Kerim-Willem closed 1 year ago

Kerim-Willem commented 1 year ago

Hi there,

I've spent quite some hours trying to figure out how to work with dynamic paths. I'm really not seeing what to do. Can anybody help me get further? Help is much appreciated.

This is what I would like to do:

In my pages folder, I have a folder called blogs. In blogs, I have the following files:

index.tsx
[blogid].tsx 
_routes.json

When I have this in my _routes.json everything works fine:

{
    "/": {
        "default": "blogs",
        "nl": "artikelen"
    }
}

With this setup, I'm able to go to http://localhost:3000/nl/artikelen and see the blogs page.

But what do I need to add to _routes.json to see content when I go to, for example: http://localhost:3000/nl/artikelen/exampleBlog.

I've been banging my head against the wall and don't seem to get any further on this point. What do I need to do?

Kerim-Willem commented 1 year ago

Never mind, I saw that this was working perfectly fine :)