我需要从集合中的元字段(内容类型:集合列表)获取图像列表。我正在使用这个逻辑,但它不起作用......
代码片段
{% assign top_collections = collection.metafields.custom.c-top-collections %}
{% if top_collections %}
<ul>
{% for collection in top_collections %}
<li>{{ collection.value }}</li>
{% endfor %}
</ul>
{% endif %}
请问这样做的正确形式是什么?谢谢你。
要获取数组,您需要编写此内容
{{ collection.metafields.custom.c-top-collections.value }}