uniq
Eliminate duplicate elements from an array, retaining only unique items in the collection.
Syntax
{{ array | uniq }}Example
{% assign cities = "Austin,Dallas,Austin,Houston" | split: "," %}{{ cities | uniq | join: ", " }}Output
Austin, Dallas, HoustonThe uniq filter processes an array and removes all duplicate entries, returning a consolidated array with every unique element appearing exactly once in order of first appearance.
On programmatic landing pages, uniq cleanses merged lists of coverage areas or service tags gathered across multiple spreadsheet columns. For example: {{ combined_areas | uniq | join: ', ' }}. This prevents embarrassing repetitions like 'Austin, Dallas, Austin' in footer coverage lists, maintaining high editorial standards.
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
