last Filter

Get the last element of an array.

Parameters

None.

Category

Array Filters

Description

Returns the last element of an array.

      {% assign places = navigation.links | map: 'title' %}
      
      <p>
        The last place to visit is {{ places | last }}.
      </p>
      

You can also access last via dot notation on the array (e.g., my_array.last).

      <p>
        The last place to visit is
        {{ navigation.links.last.title }}.
      </p>