Collection Filters
Collection filters adjust how information is displayed for the collection object and its attributes.
highlight_active_tag
string | highlight_active_tag
Wraps a specified tag in an HTML <span> tag. If the tag is active, it applies a class attribute of active. This functionality is exclusive to collection tags.
link_to_type
string | link_to_type
Generates an HTML <a> tag with an href attribute linking to a collection page that lists all products of the given product type.
HTML attributes
string | link_to_type : attribute: string
You can define HTML attributes by adding a parameter that corresponds to the attribute name and its intended value.
link_to_vendor
string | link_to_vendor
Creates an HTML <a> tag with an href attribute that links to a page displaying all products from a specific vendor.
HTML attributes
string | link_to_vendor : attribute : string
You can set HTML attributes by adding a parameter with the attribute name and its value.
sort_by
Creates a collection URL with the specified sort_by
parameter added. This filter must be used with a collection URL.
- manual (as defined in the collection settings)
- best-selling
- title-ascending
- title-descending
- price-ascending
- price-descending
- created-ascending
- created-descending
You can add the sort_by filter to the url_for_type and url_for_vendor filters.
url_for_type
Generates a URL for a page that shows all products of a specific type.
url_for_vendor
Generates a URL for a collection page that lists all products from the specified product vendor.
within
Generates a product URL for a specific collection. When using this in a collection context, you can refer to the collection object directly within the product template.
Note: Because a regular product page and a product page within a group have identical content on different URLs, it's important to think about the SEO effects of using the within filter.