In Vinson releases of SuiteCommerce Advanced, canonical URLs for commerce categories are generated as relative paths. Search engines do not index relative canonical URLs. Therefore, to ensure optimal SEO rankings, you must apply the patch described here to change your commerce category canonical URLs to use absolute paths. Best practices require customizing the existing source code using the
.extend method, as detailed below.
Step 1: Extend the Facets.Browse.View.js File
This step explains how to extend the Facets.Browse.View.js file, which is located in the Facets module.
If you have not done so already, create a directory to store your custom module.
Open this directory and create a subdirectory to maintain your customizations.
Give this directory a name similar to the module being customized. For example:
Name this file according to best practices. For example:
Open this file and extend the
getPath method to modify the url as follows.
, function (
getPath: function ()
var base_url = window.location.protocol + '//' + window.location.hostname;
var category_canonical = this.model.get('category').get('canonical') || this.model.get('category').get('fullurl');
return (category_canonical.indexOf('/') === 0 ? base_url : '') + category_canonical;
var canonical = base_url + '/' + Backbone.history.fragment
, index_of_query = canonical.indexOf('?');
// !~ means: indexOf == -1
return !~index_of_query ? canonical : canonical.substring(0, index_of_query);
Save the file.
Step 2: Prepare the Developer Tools for Your Extension
Open the FacetsExtension@1.0.0 module.
Create a file in this module and name it ns.package.json.
Build the ns.package.json file using the following code
Save the ns.package.json file.
Open the distro.json file.
This file is located in the top-level directory of your SuiteCommerce Advanced source code.
Add your custom module to the
This ensures that the Gulp tasks include your extension when you deploy. In this example, the
extensions/FacetsExtension module is added at the beginning of the list of modules. However, you can add the module anywhere in the
modules object. The order of precedence in this list does not matter.
"name": "SuiteCommerce Advanced Elbrus",
Include the module definition (
“Facets.Browse.View.Extension”) in the dependencies array of the Shopping application of the
Your distro.json file should look similar to the following:
Best practice is to place any new modules at the bottom of the list in the
dependencies array. In this case, FacetsBrowseExtension must be placed after Facets as there are dependencies on that module.
Save the distro.json file.
Step 3: Test and Deploy Your Extension
Test your source code customizations on a local server (see SCA on a Local Server) or deploy them to your NetSuite account (see Deploy to NetSuite).
If you are currently running SCA on a local server, your changes should appear on your local site immediately.
Confirm your results.
All commerce category canonical URLs have absolute paths.