Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic routing with multiple parameters in Next js

I'm using Next js. I want to use dynamic routing based on this documentation. How can I set two parameters like href="/page/[p1]/[p2]" to the Link component? What should be the structure of my page file and how use the router.query?

like image 864
elyas.m Avatar asked Sep 24 '19 08:09

elyas.m


1 Answers

Folder structure should be Like that

Page - Folder 
 blog - Folder Name
 [p1] - Folder Name
   [p2].js - File Name

it will work when you call URL like /blog/postname/id it will call p2.js page

like image 56
Gaurav verma Avatar answered Sep 30 '22 18:09

Gaurav verma