Next.js Discord

Discord Forum

How to read all pages in directory?

Unanswered
spyguy posted this in #help-forum
Open in Discord
Hey, I've been having a little trouble with this. Using Next.js 14, I have a bunch of mdx files in the App Router that I want to list on one blog page. I don't really know how to get all of those pages, though, and list them. Site is deployed on Vercel, if that makes any difference.

5 Replies

just use fs in a server component
@joulev just use fs in a server component
in my current approach i do that, but the page loads before everything is all fetched
not much i can say with this much information
@joulev not much i can say with this much information
i mean my issue is, by the time fs collects everything and i do all the processing and all of that and return a list of posts, the page has already rendered. So I guess my question is, how would I re-render the page with all of the information? Server component btw
nvm i figured out how to do it, thanks for the help though