Prevent subfolder data to be generated as pages

Hello all.

So here is a partial screenshot of how our data looks like in the content folder.

When we generate our pages, pages are generated for all md files as expected. But we do not want the files in subfolders to be generated. We do want those MD files to be available for pages in the main content folder.

To explain, here is what I am trying to do -

The apple.md file gets generated to its fruitlist/apple.html file which pulls in data from all md files in apple subfolder. However, I do not want the files apple/greenapple or apple/jonagold etc to be generated. Same for banana as well.

I have tried

 ignoreFiles = ["^content/fruitlist/[^/]+/$"]

but this does not seem to be working any good. I am not that great with RegEx and had asked a co-worker to help me here (with RegEx).

I do know that I can either set these files as draft or even add a custom front matter, but then the number of files on which I will need to work upon is greater than 7k (these are the number of files that are in the fruitlist and other subfolders of content folder that I have been asked to prevent from generating).

Any suggestions would be appreciated.

Look at this article it might help :

Do not “ignore” files. Use build options instead.