Disabling Standard Routes

Note: Spartacus 4.x is no longer maintained. Please upgrade to the latest version.

Note: Spartacus 4.x was tested with SAP Commerce Cloud versions 1905 to 2205. Spartacus 4.x has not been verified to work with (and is not guaranteed to work with) SAP Commerce Cloud 2211 or later releases.

Standard Angular routes in Spartacus, such as the route for the product details page, can be disabled through configuration. This can be useful, for example, when you want to provide custom routes instead. When you disable a route, the configuration of paths is used only to generate router links. For more information, see Configurable Router Links.

The following is an example of disabling the route for the product details page:

ConfigModule.withConfig({
  routing: {
    routes: {
      product: {
        disabled: true,
        paths: /* ... */
      }
    }
  }
})

You can also disable the generation of router links for a specific page by setting null for the route’s name, or by setting null or [] for the route’s paths, as shown in the following example:

ConfigModule.withConfig({
    routing: {
        routes: {
            product: null,
            /*
            or
              product: { paths: null }
            or
              product: { paths: [] }
            */
        }
    }
})

With this configuration, the standard Spartacus route is not matched, and the resulting configurable router link for this page is a forward slash /.