Dynamic routing with getStaticProps and getStaticPaths, unable to implement simple routing. #14048
Replies: 1 comment
-
Hey, I'm not entirely sure I understand your issue, but for what I can see you should add a getStaticProps call to the Project page. So your project detail page right now has a dynamic slug, but it just shows 'This is a project'. You want to change that, and get it to show all the information about that project. The route is called [id]. This means that you have a url parameter called id that represents the ID of a certain project. So say you have three projects:
When people visit
That way the getStaticProps function gets the information for the project with the id that is passed in the URL. Next you need to add another function: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm tying to add projects I have made to my portfolio site using Airtable as a simple data base.
I have successfully fetched and displayed the projects and routed to each projects ID. However I am stuck on how to get the other data from that specific project and to display it. Statically.
Getting the data from Airtable functionality:
Displaying the name of each project on homepage using getStaticProps()
Using
[id].js
for a dynamic routing when clicking Link above for each project sent to this page but with dynamic slug.My problem is that I want the rest of my project data to be displayed on the Project page using dynamic routing and SSG.
Any help would be appreciated.
P.S I'm new to web development.
Beta Was this translation helpful? Give feedback.
All reactions