Polishing the Index Page
Next, let’s update our index page (pages/index.js
). We need to add links to each post page using the Link
component.
Open pages/index.js
and add the following imports at the top of the file for Link
and Date
:
Then, near the bottom of the Home
component in the same file, replace the li
tag with the following:
If you go to http://localhost:3000, the page now has links to each article:
If something is not working, make sure your code looks like this.
That’s it! Before we wrap up this lesson, let’s talk about some tips for dynamic routes on the next page.