Coveo for Sitecore Legacy Search UI Framework - Duplicating the Coveo Search Component
Coveo for Sitecore Legacy Search UI Framework - Duplicating the Coveo Search Component
Coveo for Sitecore 4.1 (November 2018)
Before you modify a Coveo Search component, it’s highly recommended to duplicate it. This way, you can work on your copy while keeping the original component intact for more use and reference. This approach also enables you to work with many different versions of the same component. Here are the required steps - along with best practices - to duplicate a component.
-
From the Sitecore Content Editor, create a new folder named
Custom
under/sitecore/Layout/Sublayouts
. -
Duplicate the
Coveo Search
sublayout (right-click > Duplicate). -
Name it
Custom Coveo Search
. -
Move it to the
Custom
folder that you have just created. -
In your new sublayout (
/sitecore/Layout/Sublayouts/Custom/Custom Coveo Search
), change the value of the Ascx file field so that it points to/layouts/Custom/CustomCoveoSearch.ascx
.Note that
CustomCoveoSearch.ascx
doesn’t exist yet. It will be created in the upcoming steps. -
On the Sitecore server, locate the physical folder located at
<your sitecore instance folder>\Website\layouts.
-
In it, create a new folder named
Custom
. -
Copy the file
\Website\layouts\Coveo\CoveoSearch.ascx
to\Website\layouts\Custom\CustomCoveoSearch.ascx
. -
From the Sitecore Content Editor, create a new
Coveo-Powered Search Page
under/sitecore/Content/Home
if you don’t already have one (right-click > Insert > Coveo-Powered Search Page). -
Access the Layout Details dialog of your
Coveo-Powered Search Page
item (Presentation > Details). -
For the Default device, select Edit in the list of controls.
-
In the Device Editor dialog, under Controls, select the
Coveo Search
control and choose Change. -
In the Select a Rendering dialog, select your duplicated sublayout (
/Sublayouts/Custom/Custom Coveo Search
) and choose Select. -
In the Device Editor dialog, choose OK.
-
In the Layout Details dialog, choose OK.
-
Save your
Coveo-Powered Search Page
item. -
Validate that your Coveo-Powered Search Page now displays your new Coveo Search sublayout/component (Publish > Preview).
Visually, unless you customize the
Custom Coveo Search
component, your Coveo-Powered Search Page will look exactly the same as before. It would be a good idea to display some custom string to validate that your new component is indeed displayed as expected. For example, you may add a simple HTML paragraph as such:<p>Hello world!</p>
The result should look like this: