2

I just installed Bolt CMS and managed to edit the routing for my pages, so the route is /myPage instead of /page/myPage.

Now I want to do something similar for listing of Category entries. Currently to display all the entries in a Category the route looks like /categories/myCategory. Is it possible to change the routing, so the route will be only /myCategory?

1 Answers1

1

Based on the app/config/routing.yml docs you can do something like this.

categories:
  path:  /{slug}
  defaults:  { _controller: 'Bolt\Controllers\Frontend::taxonomy' }
  requirements:
    taxonomytype: 'categories'

Make sure this doesn't overwrite your page rule.

For more info you can check the documentation about Bolt Routing https://docs.bolt.cm/templates-routes#routing

EzeRangel
  • 21
  • 4
  • Hi, thank you. I checked the documentation, but was not sure how to edit the category listings... I tried your code (and some variations), but all I get is an error: `Warning: get_class() expects parameter 1 to be object, string given in /vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php on line 121` – constantine Oct 10 '14 at 06:33
  • Sorry, I made a little mistake. You need to tell the function controller wich taxonomy you want to list. `defaults: { _controller: 'Bolt\Controllers\Frontend::taxonomy', 'taxonomytype': 'categories' }` – EzeRangel Oct 10 '14 at 15:31