Next.js Discord

Discord Forum

Load MDX Files and display them

Unanswered
Μοχάμεντ posted this in #help-forum
Open in Discord
I want to load mdx files from ./docs and display them but instead of adding the paths to [slug].tsx in app/docs/[slug].tsx. I want it to automatically update and display the md.
I have 2 docs folders one in root and one is app directory. The one in app directory should read the files from root etc etc. I am using next-remote-mdx.
(i am a beginner so explain in cave man terms please. I just want to create a site for my discord bot)

15 Replies

Rose-breasted Grosbeak
Mb
I didn’t know there were docs for this
Rose-breasted Grosbeak
RTFM moment
RTFM?
Peterbald
RTFM → read the f--king manual
Oh
Mb
in docs they say u can style using
mdx-components.tsx
but can u do it using css file
Rose-breasted Grosbeak
Which part are you referring to?
also anyway to make it so that u dont have to add all valid slug urls in
export function generateStaticParams() {
  const slugs = ['test', 'welcome', 'about']; // Ensure all valid slugs are listed
  return slugs.map(slug => ({ slug }));
}
cuz am making a documentation page
and i have around 150 files
nvm figured it out