Hi everyone,
I hope someone can help me solve this.
In Shopify I have a Metaobject with a File field named “projects.files”. The field is listed as “List of files” and accepted specific file types is Images.
I have made an entry for this Metaobject, and I want to display it on the Metaobject template. I have tried with the following (and a lot more codes), but I can’t get it to work:
{% assign projectFiles = metafields.projects.files %}
{% if projectFiles.size > 0 %}
<ul>
{% for file in projectFiles %}
<li>
{% if file | file_is_image %}
<img src="{{ file | img_url: 'master' }}" alt="{{ file.alt }}" />
{% else %}
<a href="{{ file | file_url }}">{{ file.filename }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p>No files available for this project.</p>
{% endif %}
Can anyone tell me, how to display this?