Skip to Content
DocsCMSFiltering & Sorting

Filtering & Sorting

You can filter and sort collection items on your pages to build directories, listings, blogs, marketplaces, and other data-driven experiences. Filters reduce the dataset before items render, and sorting controls the display order.

Adding Filters to a Collection List

Filters are configured on collection layers (Collection List elements). Each filter targets a collection field and applies a condition to include or exclude items.

  1. Select a Collection List layer on the canvas
  2. In the right panel, open the Filters section
  3. Click + to add a filter condition
  4. Choose a collection field to filter by
  5. Select an operator and enter a value

Filtered items update immediately in the editor preview.

Filter Operators

Available operators depend on the field type:

Text Fields

Text, rich text, email, phone, and color fields support:

OperatorDescription
isExact match
is notDoes not match
containsValue includes the text
does not containValue does not include the text
is presentField has a value
is emptyField has no value

Number Fields

OperatorDescription
isEquals the number
is notDoes not equal the number
less thanValue is below the number
less than or equalValue is at or below the number
greater thanValue is above the number
greater than or equalValue is at or above the number

Date Fields

OperatorDescription
isMatches the date
is beforeEarlier than the date
is afterLater than the date
is betweenFalls within a date range (requires two values)
is emptyNo date set
is not emptyHas a date

Date filters support relative presets in addition to custom dates. When configuring a date filter, select a preset from the dropdown or choose “Custom date” to enter a specific date.

PresetDescription
TodayThe current day
This weekMonday through Sunday of the current week
This monthFirst through last day of the current month
This yearJanuary 1 through December 31 of the current year
In the past weekThe last 7 days
In the past monthThe last 30 days (relative to today)
In the past yearThe last 365 days (relative to today)

Presets are resolved dynamically at render time, so a filter set to “Today” always shows items matching the current date without needing manual updates.

Boolean Fields

OperatorDescription
isTrue or false

Reference Fields

Reference and single-asset fields support:

OperatorDescription
is one ofMatches any of the selected items
is not one ofDoes not match any of the selected items
existsHas a linked item
does not existNo linked item

When you use is one of or is not one of, a multi-select dropdown loads items from the referenced collection so you can pick values directly.

Multi-Reference Fields

OperatorDescription
is one ofContains at least one of the selected items
is not one ofContains none of the selected items
contains all ofContains every selected item
contains exactlyContains only the selected items, no more
item countNumber of linked items matches a comparison (equals, less than, greater than, etc.)
has itemsAt least one linked item
has no itemsNo linked items

Filter Logic

Filters use a group-based logic system:

  • Conditions within a group use OR logic — an item passes if it matches any condition in the group
  • Groups use AND logic — an item must pass all groups to appear

This lets you build expressive filters. For example, to show products that are “Electronics” or “Books” AND cost less than $50, create two groups: one with category conditions (OR) and one with a price condition.

Adding Multiple Conditions

To add an OR condition within a group, click the + button next to “Or” inside the group.

To add an AND group, click the + button at the top of the Filters panel.

Sorting

Control the display order of collection items using the sort settings on the collection layer:

Sort OptionDescription
NoneDefault database order
ManualCustom order set by drag-and-drop reordering in the CMS
RandomRandomized order on each page load
FieldSort by any collection field in ascending or descending order

When sorting by a field, you choose the field and the direction (ascending or descending). Common sort fields include date (newest first), name (alphabetical), or price (low to high).

Pagination

When a collection has many items, enable pagination to split them across pages:

  1. Select a Collection List layer
  2. In the right panel, find Pagination
  3. Enable pagination and choose a mode:
ModeDescription
PagesTraditional page navigation with previous/next buttons and page info
Load MoreA button that appends the next batch of items

Set the items per page count to control how many items appear at once. Pagination works with filters — only items that pass the filters are counted and paginated.

Styling Pagination Controls

When pagination is enabled, Ycode generates pagination controls (previous/next buttons, page info text). You can style these controls through the pagination layer settings in the design panel.

Combine filters, sorting, and pagination to build complete listing experiences. For example, a product directory with category filters, price sorting, and 12 items per page.

Last updated on