replace
Replace every occurrence of a specified substring with another replacement string.
Syntax
{{ string | replace: substring, replacement }}Example
{% assign area = "Austin TX and Dallas TX" %}{{ area | replace: "TX", "Texas" }}Output
Austin Texas and Dallas TexasThe replace filter searches a string for every instance of a designated substring and substitutes it with a replacement string. It offers a straightforward mechanism for bulk text normalization across template outputs.
On keyword-driven landing page templates, replace expands abbreviations or updates legacy terminology in vendor CSV data. For example: {{ row.service_area | replace: 'St.', 'Street' }} or replacing state postal codes with full names. This produces consistent, search-engine-friendly copy that matches organic user search queries precisely.
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
