- On Sale
- New Arrivals
- Brands
- Product types
- Items for certain gender, size, or color

- Using the API client or REST API
- Using InstantSearch on the frontend
High-level approach
- You create a category page by sending an API request with an empty
query
and afilters
parameter based on a category page identifier. - The API response returns a list of products based on the category page identifier in the
hits
attribute.
Implementation steps
- Create a data attribute that references the category page for each record.
- Set up data synchronization to automate the process of keeping records up to date with the right category page identifier.
- Set up the index configuration.
- Build the query.
- Build a frontend UI with InstantSearch (optional).
Add a category identifying attribute to each record
You can create category pages using different combinations of filter values. Although Algolia doesn’t impose any restrictions on the amount of filters you pass, best practice is to tag each item with an array of category page identifiers. A category page identifier is a unique identifier that references a particular category page. It can be a string or an integer. You can name itcategories
, categoryId
, categoryPageId
or anything else.
Importantly, you can automate tagging the records with the category page identifier to ensure that the right products always show up on the right category pages. You use this identifier:
- In the query, to filter on the product index to generate each category page
- As a category page reference, for visual merchandising in the dashboard
On Sale
or Women > Clothing > Dresses
. This way, business users, when merchandising, can easily reference the category page based on a less technical name.
Example record
You can take a look at the guides on how to format and structure data, filters, and hierarchical filters. Look at a sample record below. This item belongs to multiple category pages:JSON
Examples of filters you can apply for different category pages
Page Type | Method A: Filter on multiple attributes | Method B: Filter on Category Page ID (Recommended) |
---|---|---|
On Sale | - onSale: true - inStock: true | - categoryPageId: On Sale |
Summer Clearance | - summerClearance: true | - categoryPageId: Summer Clearance |
New Arrivals | - newArrival: true - arrivalTime > [timestamp] - inStock: true | - categoryPageId: New in |
Product Collections | - hierarchicalCategories.lvl0: Clothing - inStock: true | - categoryPageId: Clothing |
Brand Collections | - brand: Nike - inStock: true | - categoryPageId: Nike |
Hierarchical Categories (Top / Subcategories) | - hierarchicalCategories.lvl1: Clothing > Men - inStock: true | - categoryPageId: Clothing > Men |
Items for certain gender or size | - Gender: Men - hierarchicalCategories.lvl2: Clothing > Men > Pants - inStock: true | - categoryPageId: Clothing > Men > Pants |
- To use the Category Merchandising feature in the Visual Editor, your dataset must contain a unique category page identifier.
- Having a unique ID per category page makes it easier for merchandisers to reference the page and to merchandise products accordingly.
If you use method A, you can’t use the Category Merchandising feature in the Visual Editor.
Using method A, introduces room for errors for business users.
Business users who use the Visual Editor to create merchandising rules have to take an additional step to add
inStock: true
or visibility: true
as a Rule condition for every rule. Avoid that complexity by automatically updating the category page identifier for each record.Keep category identifiers up to date
Set up data synchronization to automate the process of keeping records up to date with the right category page identifier To keep records updated with relevant values, you need to push a partial update on thecategoryPageId
attribute based on stock availability or other dynamic values that affect the visibility of products on a given page. Partial record updates lets you change only some attributes, in this case categoryPageId
, which improves indexing performance. Check out the guide on different synchronization strategies.
To add products back to a particular category page:
Configure your index
DeclarecategoryPageId
as a searchable attributesForFaceting
. You can do this using the API or the dashboard.
Using the dashboard
To addcategoryPageId
as a searchable attributesForFaceting
, follow these steps:
- Select the Search product icon on your dashboard and then select your index.
- Click the Configuration tab.
- In the Facets subsection of Filtering and Faceting, click the Add an attribute button and select the
categoryPageId
attribute from the drop-down menu. - Set searchable facet on
categoryPageId
. - Save your changes.
Using the API
Build the query
The query should include the following:- Empty string
- Facet filter on
categoryPageId
- Analytics tags, which lets you view in the dashboard the click and conversion performance of specific category pages
Build a user interface with InstantSearch JS
To apply the query parameters in the frontend, instantiate theconfigure
widget and add the parameters from the step Build the query.