Skip to content
BolderBolder Developers
Esc
↑↓navigate↵open⌘Jpreview
On this page

Filters

Custom filters extending Liquid's built-in set.

Custom filters extending Liquid’s built-in set.

ImageFilters

Filter Signature Description
resized_image_url resized_image_url(filename_with_extension, geometry_string) Returns a resized URL for a theme asset image file using the given geometry string (e.g. "200x200").
resize resize(image, geometry_string) Resizes an image asset or asset URL to the given geometry string (e.g. "300x", "x200", "100x100"). Accepts an AssetDrop, LogoDrop, or plain filename string.
greyscale greyscale(image) Converts an image asset to greyscale via the resize server.
webp webp(image) Converts an image to WebP format, returning a WebP URL or setting the webp flag on the image object.

TextFilters

Filter Signature Description
translate translate(str, args = nil) defaults to given string if not found
localize localize(str, args = nil) like translate but for our system translations
split_text split_text(post_or_str, link_text = t('titles.read_more') Splits a post or string at the <!--more--> marker (or at max_length characters) and appends a “read more” link pointing to the post’s URL.
split split(post_or_str, link_text = t('titles.read_more') —
to_bool to_bool(var) Returns the string "true" or "false" from any truthy/falsy value.
to_slug to_slug(str) Converts a string to a URL-safe slug (lowercase letters, digits, and hyphens).
titleize titleize(str) Converts a dashed, underscored, or dotted string into a human-readable capitalized title.
to_money to_money(str) Wraps a numeric amount in a MoneyDrop using the shop’s currency, enabling price formatting filters.
with_discount_from with_discount_from(product_price, promo) Subtracts a promotion’s discount from a product price and returns the discounted MoneyDrop.
format_text format_text(input) Renders a Markdown string or post body as HTML, converting single newlines to <br> tags.
render_markdown render_markdown(text, options = {}) Renders a Markdown string as HTML using the Redcarpet library.
simple_format simple_format(text, options = {}) Converts plain text into HTML by wrapping paragraphs and converting single newlines to <br> tags.
simple_format simple_format(text, options = {}) Converts plain text into HTML by wrapping paragraphs and converting single newlines to <br> tags.
to_json to_json(obj) Converts an object to its JSON string representation.
bool_to_yesno bool_to_yesno(num) Converts 0 to a localized “No” string and 1 to “Yes”; passes other values through unchanged.
json_escape json_escape(text) Escapes a string for safe embedding inside a JSON string value (collapses whitespace and escapes quotes).
escape_quotes escape_quotes(str) Escapes double quotes in a string by prefixing them with a backslash.
meta_escape meta_escape(str, limit = nil) Strips HTML tags and escapes HTML entities for safe use in meta tag content attributes.
escape_html escape_html(text) Escapes HTML special characters (&, <, >, ") in a string.
strip_tags strip_tags(html) Removes all HTML tags from a string, returning plain text.
print_if_equal print_if_equal(text, one, two) Returns text if one equals two, otherwise returns nil.
print_if_matches print_if_matches(text, one, two) Returns text if one contains or matches two (supports regex strings like /pattern/). print_if_matches(“selected”, “something”, “some”)
print_if_included print_if_included(text, needle, haystack) Returns text if needle is included in haystack (array, hash, or string). Arguments can be passed in either order. print_if_included(“checked”, “things”, [“list”, “of”, “things”]) or print_if_included(“checked”, [“list”, “of”, “things”], “things”)
print_if_filter_active print_if_filter_active(text, params, link) Returns text if the given navigation link is currently active as a filter in the request params.
if_current_page if_current_page(text, link) Returns text if the current request path exactly matches the given link’s path.
if_within_section if_within_section(text, link) Returns text if the current request path starts with or matches the given link’s path.
if_within_catalog if_within_catalog(text) Returns text if the current path is within any catalog section (products, collections, types, tags, or vendors).

UrlFilters

Filter Signature Description
image_url image_url(product, size = 'large') Returns the URL for a product’s first image at the given size (e.g. "large", "medium") or geometry string.
asset_url asset_url(filename_with_extension) Returns the CDN URL for a named theme asset file (e.g. "logo.png", "app.js").
theme_asset_url theme_asset_url(filename_with_extension) returns url and path for filename depending if asset or template exists or not if not, it will point to static.bootic.net/blank.type?original=missing.type if yes, it will point to themes.bootic.net/theme/:id/:name.:type
protected_asset_path protected_asset_path(filename_with_extension, size = 'original') —
js_bundle_url js_bundle_url(filenames) Returns a single bundled URL for a comma-separated list of JS filenames.
css_bundle_url css_bundle_url(filenames) Returns a single bundled URL for a comma-separated list of CSS filenames.
scss_bundle_url scss_bundle_url(filenames) Returns a single bundled URL for a comma-separated list of SCSS filenames.
asset_url_no_timestamp asset_url_no_timestamp(filename_with_extension) Returns the asset URL without the cache-busting timestamp query string.
shared_url shared_url(path) Returns a URL for a shared (cross-theme) path with the shop’s last-refreshed timestamp appended.
image_tag image_tag(url_or_asset, alt_text = nil) Returns an <img> tag for the given URL or asset, with an auto-derived alt attribute.
lazy_image_tag lazy_image_tag(url_or_asset, alt_text = nil) Returns a lazy-loading <img> tag using data-src instead of src (for use with lazy-load JS libraries).
image_tag_with_webp image_tag_with_webp(url_or_asset, alt_text = nil) Returns a <picture> element with a WebP source and a fallback image source for browsers without WebP support.
lazy_image_tag_with_webp lazy_image_tag_with_webp(url_or_asset, alt_text = nil) Returns a lazy-loading <picture> element with WebP and fallback sources (uses data-srcset).
stylesheet_tag stylesheet_tag(url, media = 'all') Returns a <link rel="stylesheet"> tag for the given CSS filename or URL. Supports comma-separated filenames for bundling in production, or individual tags in dev mode.
stylesheet_tag_with_preload stylesheet_tag_with_preload(url, media = 'all') Returns a preload <link> tag that loads the stylesheet asynchronously and applies it once loaded.
javascript_tag javascript_tag(url, append = '') Returns a <script> tag for the given JS filename or URL. Supports comma-separated filenames for bundling in production, or individual tags in dev mode.
async_javascript_tag async_javascript_tag(url) Returns an async/defer <script> tag for non-blocking JavaScript loading.
tagged_resource_path tagged_resource_path(resource, tag, page = 1) Returns the filtered URL for a resource (collection, type, or vendor) combined with a tag filter.
typed_collection_path typed_collection_path(collection, type, page = 1) Returns the URL for a collection filtered by a product type.
tagged_collection_path tagged_collection_path(collection, tag, page = 1) Returns the URL for a collection filtered by a tag.
vendored_collection_path vendored_collection_path(collection, vendor, page = 1) Returns the URL for a collection filtered by a vendor.
tagged_typed_products_path tagged_typed_products_path(type, tag, page = 1) Returns the URL for a product type filtered by a tag.
vendored_typed_products_path vendored_typed_products_path(type, vendor, page = 1) Returns the URL for a product type filtered by a vendor.
tagged_vendored_products_path tagged_vendored_products_path(vendor, tag, page = 1) Returns the URL for a vendor’s products filtered by a tag.
vendored_products_path vendored_products_path(vendor, page = 1) Returns the URL for all products by a given vendor.

WillPaginateFilters

Filter Signature Description
pagination pagination(paginated_list, opts = {}) Renders pagination for a paginated collection using the mode set in the theme’s settings (page_numbers, more_results, or next_page).
more_results more_results(paginated_list, opts = {}) Renders a “Load more” button that appends the next page of results via AJAX. Falls back to numbered page links when the visitor navigates directly to a non-first page.
page_numbers page_numbers(paginated_list, opts = {}) Renders numbered page links with previous/next labels (classic pagination).
next_page next_page(paginated_list, opts = {}) Renders previous/next page links only (no numbered page links).

Was this page helpful?