Markdown Content Files for App Router

My original folder structure looks like this:

/ 
   /docs
     /**/*.md
   /src
      /app
         /documentation
            /[...link]
               page.tsx
      /...

I’ve also tried this:

/ 
   /src
      /app
         /documentation
            /[...link]
               page.tsx
      /content
         /docs
           /**/*.md
      /...

The point is, I’m using app routing to load markdown files dynamically. I’d like to have the markdown files in a separate folder as there will be a LOT of them and I need them organized. I’d prefer to have the files sit outside of the app folder to keep data/content and design separate.

However, when accessing the site, I get the following error for a dynamic path:

Obviously, there is a file called Introduction.md in the root docs folder that I should be able to access using the path https://...com/documentation/introduction.

How do I copy these extra files over? At what point in the build process do I include them, and again, how do I do it?

Note

I’ve tried following the details here: How to Include Files in Netlify Serverless Functions and I’ve included the following in my netlify.toml

[functions]
  included_files = ["docs/**/*.md"]

but the files still aren’t being copied.

Additionally, I’ve followed this Understanding the `included_files` settings for functions and still no luck. The files are not being copied.

Nevermind, this post helped me figure it out:

thank you for sharing your solution! This is definitely helpful for other users :+1:t6: