【发布时间】:2019-03-12 12:03:22
【问题描述】:
我正在尝试制作产品和博客文章的混合部分。我的逻辑如下:
- 获取包含所有产品的数组
- 获取包含所有博客文章的数组
- 按照某种模式合并两个数组(3 个产品 - 2 个帖子)
- 显示数据
我在合并两个数组时遇到问题。我收到错误消息“参数不是数组元素”。
{% capture product_list %}
{% for product in collection.products%}
{{product.title}}|{{product.url}}|{{product.description}}|
{{product.featured_image.src | product_img_url: 'medium' }}
{% if forloop.last == false %}::{% endif%}
{% endfor %}
{% endcapture %}
{% capture blog_list %}
{% for blog in blog.articles%}
{{blog.title}}|{{blog.url}}
{% if forloop.last == false %}::{% endif%}
{% endfor %}
{% endcapture %}
{% assign plants = product.list | concat: blog.list %}
{{ plants | join: ", " }}
【问题讨论】:
标签: shopify