concat

连接(合并)多个数组。结果数组包含来自输入数组的所有项。

输入

{% assign fruits = "apples, oranges, peaches" | split: ", " %}
{% assign vegetables = "carrots, turnips, potatoes" | split: ", " %}

{% assign everything = fruits | concat: vegetables %}

{% for item in everything %}
- {{ item }}
{% endfor %}

输出

- apples
- oranges
- peaches
- carrots
- turnips
- potatoes

你可以将多个 concat 过滤器串联在一起,以连接两个以上的数组。

输入

{% assign furniture = "chairs, tables, shelves" | split: ", " %}

{% assign everything = fruits | concat: vegetables | concat: furniture %}

{% for item in everything %}
- {{ item }}
{% endfor %}

输出

- apples
- oranges
- peaches
- carrots
- turnips
- potatoes
- chairs
- tables
- shelves