push

Table of contents

Removes the last element from an array and returns array with remaining elements. If an integer is passed as argument, this amount of elements will be removed.

{{ "John, Paul, George" | split: ", " | push: "Ringo" | join: ", " }}
Input
"John, Paul, George, Ringo"
Ouput

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

{{ site.pages | push: page }}

Need help?

Do you have any question which is not answered in this knowledge base? Contact us. We are here to help you.