【发布时间】:2019-02-10 08:57:29
【问题描述】:
以前有这种问答,但有什么适合我的。 我想在空数组和数组中连接液体中的数组
array1subject = ''
array2tsubject = ["appple", "pine appeld"]
数组我想要得到的东西 ["appple", "pine appeld"]
我试过把这个结合起来
{% assign subject = '' %}
{% for post in site.programming %}
{% assign tsubjects = post.categories %}
{% assign subject=subject | append: tsubjects %}
{% endfor %}
{% assign subject = '' %}
{% for post in site.programming %}
{% assign tsubjects = post.categories %}
{% subject=subject | concat: tsubjects %}
{% endfor %}
但没有任何变化,主题仍然是空的。
我认为这是因为concat、concat 像这样连接数组形状:{% assign vegetables = "broccoli, carrots, lettuce, tomatoes" | split: ", " %}
但我想连接以下类型:{% assign vegetables = ["broccoli", "carrots", "lettuce", "tomatoes"] | split: ", " %}
我不确定它们为什么不起作用的原因。请帮帮我。
【问题讨论】: