Accessing files within a template

I’m working on a photography site and want to do page with just a bunch of photos, but right now the only solution I have is just to make a page, like gallery.html and then put a bunch of img tags

I looked at the get_image_metadata but that only works if I input the specific image file name.

I’d preferably like to get all filenames from a specific folder in the template and then be able to then use that to create my image tags so I don’t have to have to do this manually.

Something like this.

{% set filenames = get_path_filenames(path="static/images/photography/*.*", format=["jpg","png"]) %}

{%- for name in filenames -%}
    <img src="{{ name }}" class="gallery-image">
{%- endfor %}

This would also be a useful feature in combination with the load_data function because it would let you have a folder of json objects, iterate over all the json objects, and then load them with load_data something like this?

{% set filenames = get_path_filenames(path="static/data/*.*", format=["json"]) %}

{%- for name in filenames -%}
{% set data = load_data(name, format="json") %}
{%- endfor %}

Anyway thought it would be nice, and I didn’t see anything in the docs that let you access files like this without having a pre-compiled list of files in a text document or something.