How can I use taxonomy with images metadata?

Hi there, I have some images inside my page.
Each image is associated with a metadata file like this:


Each yaml file has something like this for example:

description: a test description
    tag: [blue,red,green]

How can I loop and filter only the “red” tagged images for example ?
I’m trying this on my template, but it’s not working

{% for myimage in taxonomy.findTaxonomy({'tag':['red']}) %}
    <li>{{ myimage.description }}</li>
{% endfor %}

I also tried using but no luck.

Any tip ?


I think I should have rephrased my questions and asked instead
"Is this possible ?".

Nevertheless I think I have found an alternative to achieve my goal.
I have changed my yaml file to look like this:

description: test description
color: red

And them on my template I’m using something like this:

{% for myimage in %}
   {% if myimage.color == "red" %}
      {{ dump(myimage.description) }}
   {% endif %}
{% endfor %}

Any thoughts ?

If that works, I think it looks like a solid solution. Media YAML just supports standard yaml syntax for storing attributes, no need to make it more complex than it needs to be. Usually the simplest solution is the best.