Text
Format and transform text in Easol themes.
Text filters help you format strings for display, URLs, and natural language.
Create URL-friendly strings
Use parameterize to convert a string into a URL-friendly format.
Special characters are removed, whitespace is replaced with hyphens (-), and the result is converted to lowercase.
{{ "Music Festival" | parameterize }}This renders:
music-festivalThis filter is useful when generating slugs or URL parameters from user-provided content.
Singular and plural words
Use pluralize to output the correct singular or plural form of a word based on a number.
{{ item_count }} {{ item_count | pluralize: "item" }} in your cartIf item_count is 2, this renders:
2 items in your cartYou can also provide a custom plural form.
{{ people_count }} {{ people_count | pluralize: "person", "users" }} in your venueIf people_count is 2, this renders:
2 users in your venueJoin a list into a sentence
Use to_sentence to convert an array of strings into a human-readable sentence.
For example, given products named Adult, Teen, and Child:
{{ products | map: "name" | to_sentence | append: "Tickets" }}This renders:
Adult, Teen and Child TicketsThis filter is particularly useful when displaying lists of product names, destinations, activities, or categories.
Choosing the right filter
| Filter | Use when |
|---|---|
parameterize | Convert a string into a URL-friendly slug. |
pluralize | Display the correct singular or plural word based on a number. |
to_sentence | Convert an array of strings into a readable sentence. |