Manage Components on a Per-Tab Basis
Manage Components on a Per-Tab Basis
Legacy feature
This article pertains to the Coveo Hive framework which is now in maintenance mode. Choose one of Coveo’s more modern, lightweight, and responsive libraries for any future search interface development. See the search interface Implementation guide for more details. |
When adding tabs to your search interface, you most likely want to manage your components on a per-tab basis.
The Coveo JavaScript Search Framework data-tab
and data-tab-not
attributes may be used to show components only when a user selects one or several specific tab(s) (see Use Components Only on Specific Tabs).
In the February 2019 version of Coveo for Sitecore, a new data source option called Additional Data Attributes
was added on many Coveo Hive components to leverage Coveo JavaScript Search Framework options not directly available in the data source itself (see Pass Non-Fronted JavaScript Framework Properties to Hive Components).
The Additional Data Attributes
option is therefore the mechanism you should use to define component visibility on a per-tab basis.
Note
Facets are already not displayed when no search result item contains the associated field.
Leveraging the |
You have added several tabs in your Coveo for Sitecore search interface.
On the All Content
tab, your users can search for any item in your web database.
On the Staff
tab, you’ve configured a filtering rule so that only items based off of a staff
template.
You already have numerous facets displayed when the All Content
tab is selected and you feel that it’s only relevant to display the Department
facet when a user selects the Staff
tab.
To display the Department
facet only when a user selects the Staff
tab
-
Add the
Department
facet to your search interface (see Coveo Facet). -
In the Sitecore Experience Editor, select the
Department
facet. -
In the floating toolbar, select the Edit the rendering’s data source option. It should be the leftmost option in the toolbar.
-
Scroll all the way down to the Attributes section.
-
Under
Additional Data Attributes
, in the key field, typetab
. -
In the value field, paste the
DOM Unique Id
value of theStaff
Coveo Tab component. -
Click OK. The changes are applied immediately in the Experience Editor.
-
Publish your changes.
Notes
|