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
フィルターを使用して、2 つ以上の配列を連結できます。
入力
{% 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