How to iterate over headless pages?

I was able to do something similar i.e. I needed to access pages programatically without rendering them.

Basically, you need to use readDir and readFile along with unmarshall which allows you to get the front matter at least in a “data” format/interface.