strip_html
문자열 내부에 포함된 모든 HTML 태그 요소(<...>)를 완전히 제거하고 순수 텍스트만 남기는 필터입니다.
문법
{{ html_string | strip_html }}예시
{% assign raw_html = "<h3>타이틀</h3><p>본문 내용</p>" %}{{ raw_html | strip_html }}결과
타이틀본문 내용strip_html 필터는 문자열 안에 섞여 있는 모든 HTML 태그 및 마크업 요소를 찾아 제거하고 오직 순수한 텍스트 문자만을 걸러내어 반환하는 텍스트 추출 필터입니다. 서식 태그가 포함된 리치 텍스트를 일반 텍스트 전용 영역에 넣을 때 사용합니다.
키워드 조합 페이지에서는 본문용 HTML 속성 데이터를 검색 엔진용 메타 설명문(meta description)이나 오픈그래프 요약문에 재활용할 때 필수적입니다. 예를 들어 <meta name="description" content="{{ row.body_html | strip_html | truncate: 150 }}">처럼 작성하여 마크업 코드 노출 없이 깔끔한 검색 스니펫을 완성할 수 있습니다.
필터
- 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
