# Accessing files within a template

**URL:** <https://zola.discourse.group/t/accessing-files-within-a-template/2601>\
**Category:** Feature requests\
**Created:** [May 9, 2025, 12:24am UTC](https://zola.discourse.group/t/accessing-files-within-a-template/2601 "2025-05-09T00:24:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Snowdrama](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/snowdrama/32/1274_2.png) [@Snowdrama](https://zola.discourse.group/u/Snowdrama)\
**Post date:** [May 9, 2025, 12:24am UTC](https://zola.discourse.group/t/accessing-files-within-a-template/2601/1 "2025-05-09T00:24:50Z")

</div>

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.

```auto
{% 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?

```auto
{% 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.

---

<div class="post-metadata">

**Author:** ![ufukayyildiz](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/ufukayyildiz/32/1464_2.png) [@ufukayyildiz](https://zola.discourse.group/u/ufukayyildiz)\
**Post date:** [May 27, 2025, 7:39pm UTC](https://zola.discourse.group/t/accessing-files-within-a-template/2601/2 "2025-05-27T19:39:09Z")

</div>

Hi,

Did you fix this?

Thanks.

---

<div class="post-metadata">

**Author:** ![Snowdrama](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/snowdrama/32/1274_2.png) [@Snowdrama](https://zola.discourse.group/u/Snowdrama)\
**Post date:** [June 5, 2025, 7:09am UTC](https://zola.discourse.group/t/accessing-files-within-a-template/2601/3 "2025-06-05T07:09:41Z")

</div>

I did not actually build this, it’s something I’d love to see able to be done in Zola which is why I posted it as a feature request.

I may consider looking into doing a PR for something like this at some point when I have time but for now this is just a feature request, and it seems that it’s something that’s been posted about before there’s some old posts from 2020/2021 that ask about this as well.

Most seem to take some approach with page.assets using asset colocation and the shortcode mentioned here but I have not been successful getting that to work, even though my images are in the same folder, the example in the documentation doesn’t work:

> **[Image processing | Zola](https://www.getzola.org/documentation/content/image-processing/#creating-picture-galleries)**
>
> Everything you need to make a static site engine in one binary.

When printing `page.assets` I get an empty array, so unfortunately not sure what’s happening

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [June 23, 2025, 12:35pm UTC](https://zola.discourse.group/t/accessing-files-within-a-template/2601/4 "2025-06-23T12:35:26Z")

</div>

That does work, make sure you have a folder and an index.md page in there. See [zola/docs/content/documentation/content/image-processing at master · getzola/zola · GitHub](https://github.com/getzola/zola/tree/master/docs/content/documentation/content/image-processing) for how that page is setup in Zola
