How to loop through all partials in a given folder

Not sure whether this is feasible or not with MiddleMan only or I should create a custom helper, but I was wondering to loop through all partials in a given folder.

I can’t use the sitemap object as files are ignored.

What should I do?

Why are you trying to loop through all partials in a give folder? Sometimes if you see the why the answer comes :wink:

Because I need to get the filename and pass to another routine I create that reads the YAML included in each of them to attach to the output.

Hope it makes sense.

Sorry, it isn’t making sense to me…

Let just say your have 3 files, abe.md, bob.md, & cal.md your looking to find the the x in the x.md and then:

<%= partial("YAML_reading_partial", :locals => { :filename => x }) %>

say a /source/partials/blocks folder with the following three files

_a.md
_b.md
_c.md

Those partials are part of one template, and I need to loop through them to get the final file using the partial function.

As soon as the partial has been imported, I need to add an image, whose path is included in the frontmatter of each of those partial. Image cannot be included as part of the markdown (for html nesting reasons).

How can I get that a?
Even better it would be to get the content of the YAML, thought now I have done this with a custom helper.

Why not use the content_for helper?

I explored that approach too, but the problem of looping through the partial folder to retrieve all the files still remains.