Spartacus Category Routing

802 Views Asked by At

I examine Spartacus documents, we can edit the url for the products as we want.

ConfigModule.withConfig({
  routing: {
    routes: {
      product: {
        paths: [
          'electronics/my-categories/p/:productCode/'
        ]
      },
    }
  }
})

I want to do a similar url editing for categories but I don't see any changes.

category: {
        paths: [
          'categories/my-categories/..'
        ]
      }

The URL is still like this

http://localhost:4200/electronics-spa/en/USD/Open-Catalogue/Cameras/Film-Cameras/c/574

Where am I doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

URL http://localhost:4200/electronics-spa/en/USD/Open-Catalogue/Cameras/Film-Cameras/c/574 likely comes from the CMS-driven links. They are not controlled by Spartacus configuration. To change the navigation links, you need to amend them in your CMS backoffice system.

By default, both types of category links are recognized:

  • the ones controlled by Spartacus configuration
  • the CMS-driven ones (spartacus recognizes them thanks to pattern **/c/:categoryCode by convention).

You can customize what is recognized as a valid product/category URL though. See: