remove_first
Remove only the first occurrence of a specified substring from the input string.
Syntax
{{ string | remove_first: substring }}Example
{% assign text = "Dallas Metro Dallas" %}{{ text | remove_first: "Dallas " }}Output
Metro DallasThe remove_first filter deletes only the initial occurrence of a target substring within an input string, leaving subsequent duplicate occurrences intact. Unlike remove which wipes every match, remove_first targets only the first match.
In programmatic SEO landing pages, remove_first cleans up redundant brand prefixes in headline copy. For example: {{ row.headline | remove_first: row.brand_name }}. This strips duplicate brand prefixes from headings while preserving subsequent context.
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
