# Category Pages

This Site Search 360 demo shows how a shop's category pages can each have their own filters. Use the buttons in the demo to switch between two category pages and a normal search, and watch the filters change: **Dairy & Eggs** filters by brand, fat and price, **Sweets & Snacks** by availability and calories, and a search shows the usual category, price and rating. View the [ss360Config](#) to check the configuration.

* A category page shows the filters set up for its category under [Navigational Query Filters](https://docs.sitesearch360.com/navigational-query-filters.md). A normal search keeps your [global filters](https://docs.sitesearch360.com/filter-setup.md).
* `results.categorySearch` makes a page a category page. `urlPattern` reads the category from the page URL: the buttons open this page with `?cat=Dairy%20%26%20Eggs` or `?cat=Sweets%20%26%20Snacks`. `queryPathSeparator` splits a path such as `Books/History` into its categories.
* `replacementPatterns` turns the URL encoding back into the category name, so `Dairy%20%26%20Eggs` becomes `Dairy & Eggs`. `ignoredQueryParams` stops `cat` from also being read as a filter.
* The category names must match the names in your product feed. Other ways to read the category, for example from the breadcrumb, are listed under `categorySearch` in [Advanced Parameters](https://docs.sitesearch360.com/configuration-parameters.md).

**In the Control Panel:** set up the filters of each category under **Filters and Sorting** → [**Navigational Query Filters**](https://app.sitesearch360.com/filter/navigational-filters), then add `categorySearch` under **Design & Publish** → [**Advanced**](https://app.sitesearch360.com/pluginConfiguration?tab=advanced-configuration) → **Configuration** → **Plugin Configuration**.

For filters in a normal search, see the [Filters](https://docs.sitesearch360.com/filters-example.md) demo.

```
window.ss360Config = {
   siteId: '83460', /* Replace with your site id */
   searchBox: {
      selector: '#searchBox' /* Replace with the css selector of your search box */
   },
   results: {
      embedConfig: {
         contentBlock: '.example__page-content-block' /* Replace with the css selector of the element the results go into */
      },
      categorySearch: {
         urlPattern: '[?&]cat=([^&]+)', /* Replace with the pattern of your category page URLs */
         queryPathSeparator: '/',
         replacementPatterns: {
            '%20': ' ',
            '%26': '&'
         },
         ignoredQueryParams: ['cat']
      }
   },
   contentGroups: {
      include: ['Grocery Products']
   },
   filters: {
      enabled: true,
      position: 'left'
   }
};
```

```
{"siteId":"83460","searchBox":{"selector":"#searchBox"},"results":{"embedConfig":{"contentBlock":".example__page-content-block"},"categorySearch":{"urlPattern":"[?&]cat=([^&]+)","queryPathSeparator":"/","replacementPatterns":{"%20":" ","%26":"&"},"ignoredQueryParams":["cat"]}},"contentGroups":{"include":["Grocery Products"]},"filters":{"enabled":true,"position":"left"}}
```
