first
Extract and return the first element from an array collection.
Syntax
{{ array | first }}Example
{% assign cities = "Denver,Boulder,Aurora" | split: "," %}{{ cities | first }}Output
DenverThe first filter extracts the leading item from an array without requiring explicit index notation or loop constructs, returning nil if the collection is empty.
In programmatic SEO workflows, first retrieves the primary location or flagship specialty from a comma-separated list of regional attributes. For example: Serving {{ row.metro_areas | split: ',' | first }} and surrounding communities. This provides a clear focal point in page titles and hero introductions while retaining comprehensive secondary coverage.
Filters
- abs
- append
- at_least
- at_most
- capitalize
- ceil
- compact
- concat
- date
- default
- divided_by
- downcase
- escape
- escape_once
- first
- floor
- join
- last
- lstrip
- map
- minus
- modulo
- newline_to_br
- plus
- prepend
- remove
- remove_first
- replace
- replace_first
- reverse
- round
- rstrip
- size
- slice
- sort
- sort_natural
- split
- strip
- strip_html
- strip_newlines
- times
- truncate
- truncatewords
- uniq
- upcase
- url_decode
- url_encode
- where
- raw
- slugify
- number_format
