Help searching for content in several .md files

I have a hugo site that has product pages and each of these pages presents a list of related brands that comes from the related_brands.md file. In another part of the site, I have pages for each of the brands and on these pages I would like to present the list of products that mentioned the brand in the related_brands.md files.

simplified version of my file and folder structure

 content
    └── products
            ├── product1
                       ├── description.md
                       ├── other-info.md
                       ├── related_brands.md
                       └──  _index.md
                                       [...]
             ├── product-n
                       ├── description.md
                       ├── other-info.md
                       ├── related_brands.md
                       └──  _index.md
      └── brands
             ├── brand1
                       ├── description.md
                       ├── other-info.md
                       └──  _index.md
                                       [...]
             ├── brand-n
                       ├── description.md
                       ├── other-info.md
                       └──  _index.md

I’m trying to create a partial in the layout I use on the brands pages to show the list of products that have cited the current brand in the related_brands.md file. The search would be done using the Title of the brand page and would present the Title of the product page with the link to it.

I’m thinking of making a range that loops through all the related_brands.md files and stores the product page link. But here my problems started: :sob:

  • is it possible to read all related_brans.md files from all product folders? How do I create this loop? :thinking:

Please feel free to suggest other approaches.

Thank you for any help and ideas to solve this problem! :innocent:

Use Hugo’s taxonomy system.