QueraTeam / django-nextjs

Next.js integration for Django projects
MIT License
341 stars 17 forks source link

Does this support dynamic routing such as passing a slug? #18

Closed adambirds closed 1 year ago

adambirds commented 1 year ago

Does this support dynamic routing such as passing a slug?

danialkeimasi commented 1 year ago

Yes, simply ensure that the Django and Next URLs match. Take this as an example:

# Django's urls.py
urlpatterns = [
    path("companies/<str:slug>", nextjs_pages.company, name="company"),
]
# in Next.js pages directory
❯ tree
.
└── companies
    └── [slug]
        └── index.tsx