Creating a blog page with slug and MDX
Answered
Sun bear posted this in #help-forum
Sun bearOP
Hello, I'm trying to make a blog page on my website. I want to have support for my posts to be mdx files and by having dynamic routes. Ideally I would like to have the
Currently I have just added place holder stuff in order to make the page but now I want to hook up the functionality for it. I want to check in a folder for all of the mdx files and on my blog page loop through them and render each of them like I'm doing with my dummy data currently. Then lastly I would like to have a slug where I can setup the general page for a post and just inject the the corresponing MDX code into that page.
Is this possible and if so what would be a good approach to do it? I have seen some other people do it with the contentlayer package but with the recent changes to mdx I thought maybe it is possible to do this without the need of extra packages
/blog
page show all of the posts I have like shown in one of the images attached to this message. Currently I have just added place holder stuff in order to make the page but now I want to hook up the functionality for it. I want to check in a folder for all of the mdx files and on my blog page loop through them and render each of them like I'm doing with my dummy data currently. Then lastly I would like to have a slug where I can setup the general page for a post and just inject the the corresponing MDX code into that page.
Is this possible and if so what would be a good approach to do it? I have seen some other people do it with the contentlayer package but with the recent changes to mdx I thought maybe it is possible to do this without the need of extra packages
Answered by Sun bear
I used this template as a reference and got it to work
https://vercel.com/templates/next.js/portfolio-starter-kit
https://vercel.com/templates/next.js/portfolio-starter-kit
1 Reply
Sun bearOP
I used this template as a reference and got it to work
https://vercel.com/templates/next.js/portfolio-starter-kit
https://vercel.com/templates/next.js/portfolio-starter-kit
Answer