Date Filters
Date
Format a timestamp date based on strftime notation.
Arguments
Examples
Input
assuming something.date is "2022-11-25T14:58:36Z"
{{ something.date | date: '%B %d, %Y' }}
Output
November 25, 2022
Date properties also support all the following String filters
Append
Adds a given string to the end of a string.
Arguments
Examples
Input
assuming product.title is "Health potion"
{{ product.title | append: ' with extra magic.' }}
Output
Health potion with extra magic.
Camelize
Converts a string to CamelCase.
Examples
Input
assuming product.title is "Health potion"
{{ product.title | camelize }}
Output
HealthPotion
Capitalize
Capitalizes the first word in a string.
Examples
Input
assuming product.title is "health potion"
{{ product.title | capitalize }}
Output
Health potion
Downcase
Converts a string to all lowercase characters
Examples
Input
assuming product.title is "Health Potion"
{{ product.title | downcase }}
Output
health potion
Escape
Escapes special characters in HTML, such as <>, ', and &, and converts characters into escape sequences.
Examples
Input
assuming product.description is "Health " Potion"
{{ product.title | escape }}
Output
Health " Potion
Left strip
Strips all whitespace from the left of a string.
Examples
Input
assuming product.description is " Some potions create whitespace. "
{{ product.description | lstrip }}
Output
"Some potions create whitespace. "
Prepend
Adds a given string to the beginning of a string.
Arguments
Examples
Input
assuming product.title is "Health Potion"
{{ product.title | prepend: 'Super ' }}
Output
Super Health Potion
Remove
Removes any instance of a substring inside a string. Use single quotes around a longer string of text. i.e. | remove : 'long string'.
Arguments
Examples
Input
assuming product.title is "Health potion"
{{ product.title | remove: 'o' }}
Output
Super Health Ptin
Remove First
Removes the first instance of a substring inside a string.
Arguments
Examples
Input
assuming product.title is "Health potion"
{{ product.title | removeFirst: 'o' }}
Output
Super Health Ption
Remove Last
Removes the last instance of a substring inside a string.
Arguments
Examples
Input
assuming product.title is "Health potion"
{{ product.title | removeLast: 'o' }}
Output
Super Health Potin
Replace
Replaces any instance of a substring inside a string with a given string.
Arguments
Examples
Input
assuming product.handle is "new-health-potion"
{{ product.handle | replace: '-', '_' }}
Output
new_health_potion
Replace First
Replaces the first instance of a substring inside a string with a given string.
Arguments
Examples
Input
assuming product.handle is "new-health-potion"
{{ product.handle | replaceFirst: '-', '_' }}
Output
new_health-potion
Replace Last
Replaces the last instance of a substring inside a string with a given string.
Arguments
Examples
Input
assuming product.handle is "new-health-potion"
{{ product.handle | replaceLast: '-', '_' }}
Output
new-health_potion
Right strip
Strips all whitespace from the right of a string.
Examples
Input
assuming product.description is " Some potions create whitespace. "
{{ product.description | rstrip }}
Output
" Some potions create whitespace."
Slice
Returns a substring, starting at a given 0-based index.
Arguments
Examples
Input
assuming product.handle is "new-health-potion"
{{ product.handle | slice: 0,3 }}
Output
new
Strip
Strips all whitespace from the left and right of a string.
Examples
Input
assuming product.description is " Some potions create whitespace. "
{{ product.description | strip }}
Output
"Some potions create whitespace."
Truncate
Truncates a string down to a given number of characters.
Arguments
Examples
Input
assuming product.title is "Health Potion"
{{ product.title | truncate: 9 }}
Output
Health...
Downcase
Converts a string to all uppercase characters
Examples
Input
assuming product.title is "Health Potion"
{{ product.title | upcase }}
Output
HEALTH POTION