Skip to content

Replace First ​

Replaces the first instance of a substring with a different string.

liquid
{{ string | replace_first: substring, replacement }}

Example ​

liquid
{{ 'red shirt, red hat' | replace_first: 'red', 'blue' }}

Output

html
blue shirt, red hat