where
배열 내부의 객체나 요소들 중 지정한 프로퍼티 값이 목표 일치 조건과 맞아떨어지는 항목들만 선별하는 필터입니다.
문법
{{ array | where: property, target_value }}예시
{% assign words = "가,나다,라" | split: "," %}{{ words | where: "length", 1 | join: ", " }}결과
가, 라where 필터는 배열 컬렉션을 순회하며 지정한 속성(property)의 값이 제시한 비교 대상 값과 정확히 일치하는 요소들만을 추려내어 새로운 하위 배열로 반환하는 데이터 필터링 필터입니다.
키워드 조합 페이지에서는 연관 페이지 목록(page.related)이나 지점 데이터에서 특정 조건을 만족하는 대상만을 골라내어 추천 섹션에 노출할 때 핵심적으로 쓰입니다. 예를 들어 {% assign local_siblings = page.related | where: 'city', row.city %}처럼 현재 보고 있는 행과 같은 시·군에 속한 형제 페이지만을 엄선하여 본문 내부 링크의 연관성을 극대화할 수 있습니다.
필터
- 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
