concat

Filter= concat

Concatenates (joins together) multiple arrays. The resulting array contains all the items from the input arrays:

INPUT

OUTPUT

{% 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

You can string together concat filters to join more that two arrays:

INPUT

OUTPUT

{% 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