where

Filter an array of objects to include only elements matching a given property value.

Syntax

{{ array | where: property, target_value }}

Example

{% assign words = "dog,elephant,cat" | split: "," %}{{ words | where: "length", 3 | join: ", " }}

Output

dog, cat

The where filter filters an array of items, retaining only those elements where the specified property matches the target value provided as the second argument.

On programmatic landing pages, where filters related sibling collections to highlight nearest neighbors or specific service categories. For example: {% assign metro_peers = page.related | where: 'state', row.state %}. Looping over these pre-filtered peers builds highly localized cross-link clusters that maximize internal link relevancy.

Try this syntax in the editor.