Lesson

Create Next.js dynamic pages

One of the main benefits of using Next.js is the smooth way to setup dynamic pages. In our `pages` folder, create a new folder and file called `blog/[slug].js`. The brackets are what tell Next that the file is going to be a dynamic page. Here we are going to use an almost duplicate `getStaticProps` function that we created in the previous lesson. The difference is we are going to be bringing in our page context to fill out the right page data. Lastly, we will loop over all of our posts using a for loop.

Duration
5 min
Access
Included
Transcript
Needs source