Understanding How Coveo for Sitecore Loads the Coveo JavaScript Files (CDN)

The Coveo for Sitecore Hive Framework can load the Coveo JavaScript Search Framework files using the Content Delivery Network (CDN). The Coveo JavaScript Search Framework CDN base URI is https://static.cloud.coveo.com/searchui/<VERSION_NUMBER>.

When a new version of the Coveo JavaScript Search Framework is released, Coveo updates the CDN. Therefore, if you’re using the CDN, Coveo can push hotfixes into the CDN and the page will automatically be updated.

Moreover, the CDN removes some load from your site and instead requests files located on an external server. Usually, this separation translates into more responsive search interfaces.

For more information about the JavaScript Search Framework CDN, see JavaScript Search Framework CDN Links.

Coveo for Sitecore (October 30, 2020)

You can now load Coveo for Sitecore Hive (i.e., Coveo for Sitecore-specific) JavaScript resources from the CDN along with the Coveo JavaScript Search Framework resources. The Coveo for Sitecore Hive CDN base URI is https://static.cloud.coveo.com/coveoforsitecore/ui/<VERSION_NUMBER>.

Using Local Resources

If you want to use the local files in your Sitecore instance instead of the ones from the CDN, you must add a data source to your Coveo Search Resources rendering.

Once added, edit the properties of this data source and select the Use local files for Coveo JavaScript Resources option. If you prefer to fetch the Coveo Javascript resources without the hotfixes, you should use local resources.

Switching Between the CDN and Local Files

To allow loading both the Coveo JavaScript Search Framework and Coveo for Sitecore Hive resource files from the CDN, install the latest version of Coveo for Sitecore (see Releases and Downloads and Installing Coveo for Sitecore).

In the Content Editor, create a new search page or select an existing one. Open it in the Experience Editor.

  1. You first need to set a data source for the Coveo Search Resources rendering. If it already has a data source, you can skip this step.

    1. Find the Coveo Search Resources rendering, which is usually located at the bottom of the page.

    2. Select the Coveo Search Resources rendering to display its floating toolbar.

    3. In the floating toolbar, select Change associated content.

    4. In the configuration window, select Create New Content.

    5. Select the parent item for your data source and click OK.

  2. With the Coveo Search Resources rendering selected, in the floating toolbar, select the Edit the rendering’s data source option.

  3. In the data source options dialog:

    1. If you want to load Coveo JavaScript Search Framework and Coveo for Sitecore-specific JavaScript files using the CDN, leave the Use local files for Coveo JavaScript Resources check box blank. And then:

      • To use the default version of the CDN files, leave the Coveo JavaScript Search Framework CDN Version field blank, or

      • If you want to reference a more recent version of the Coveo JavaScript Search Framework, type the number of your Coveo JavaScript Search Framework version in the Coveo JavaScript Search Framework CDN Version field (see Coveo JavaScript Search Release Notes). The CDN version must be in the major.minor format, as in the example below.

        Coveo can’t guarantee your Coveo for Sitecore version works with a more recent version of the Coveo JavaScript Search Framework than the one your Coveo for Sitecore version has been coded for and tested with.

    2. If you prefer to fetch Coveo JavaScript Resources using local files, select Use local files for Coveo JavaScript Resources. The path used to locate the resources is /Coveo/Hive unless you enter another one in the Resources local path field.

The Use local files for Coveo JavaScript Resources setting affects both Coveo for Sitecore Hive and Coveo JavaScript Search Framework resources. If a situation requires you to load one resource locally and the other from the CDN, you need to edit the SearchResources.cshtml view file (see Duplicating a Coveo for Sitecore Component to Modify Its HTML).

Recommended Articles