/
unshift

unshift

Prepends object to the front of an array, moving other elements upwards.

Input:

{{ "Paul, George, Ringo" | split: ", " | unshift: "John" | join: ", " }}

Output:

"John, Paul, George, Ringo"

This filter also works on arrays with objects, generated by Plate:

{{ site.pages | unshift: page }}

 

Related content

request
request
Read with this
push
More like this
shift
More like this
pop
More like this
Filters
Filters
More like this
to_json
to_json
More like this