Looping over filenames in template

I’m working on a site that displays links to media files and I’ve been using a bash script to generate the _index.md file with an array of filenames which is used to generate the links in the template file. Is this the best way or is there a way for Zola to loop over a directory of filenames without needing the script? I don’t have the files in the Zola project because I have a separate subdomain setup with caching for the media files. Thanks!

If you have a list of files, you could use the load_data function to read it, assuming you can have it in a supported format: Overview | Zola