Trying to exclude subfolders in one instance only

Hello friends,

I do hope you had a great start to 2023.

Is there any way where I can exclude the subfolders in the content folder - but with only one limitation - I need to exclude those only on one generated page. For all other pages that are being generated, I do need the entire structure to process.

Basically this is my folder structure -

content
└── fruits
         └── apple
                    ├── red.md
                    └── green.md
         └── berries
                    ├── blueberries.md
                    └── gooseberries.md
         └── strawberry.md
         └── starfruit.md
         └── apple.md
         └── berries.md
└── sales
          └── monthlysales.md
          └── quarterlysales.md

In the sales folder (content/sales) I have empty md files (monthlysales.md and quarterlysales.md) - I create these just because it gets easy to create their layouts in one single.html.

On all other pages, I do need everything to process - and that single.html in the layouts/fruits is working perfectly.

In the layouts folder -
layouts/fruits/single.html - process all files and renders every page perfectly (as expected and desired).

However, in the layouts/sales/single.html - I need to ignore the subfolders (and the md files in them). So, only the strawberry.md, starfruit.md, apple.md and berries.md need to be processed on this page and I need to exclude the two folders (and hence the files in these folders as well) apple and berries.

This is the reason I cannot ignoreFiles in the config.toml file.

Is there any workaround for achieving this ?

Thank you for reading and taking out time to reply.

Stay Safe and Healthy.
Cheers,
Sid.

https://gohugo.io/content-management/build-options/

Happy 2023 sir.

I believe it will be the “Not Publishing a Page” section with publishResources set to false.

I will keep you posted.

Thanks :slight_smile: