Issue when using : on routes

I was trying to have url like projects/type:books instead of projects/type/books, using routes and controllers. Everything works fine if I use type/books or type_books or type;books but it doesn’t work with ‘:’.
Is there a way to fix it?

My config.php

'routes' => [
        'pattern' => 'projects/type:(:any)',
        'action' => function ($type) {
            return page('projects')->render([
                'type' => $type

My controller
return function ($page, $type) {

$projects = page('projects')->children()->listed();

if ($type) {
    $projects = $projects->filterBy('category', ucfirst($type), ',');

return [
    'projects' => $projects,


You don’t actually need a route for the parameters.

Thank you @texnixe I was not aware about param() and now I love them!!!

Looks like you found the information you need? I was a bit short because because on the road and only on the phone so did not elaborate what I meant…

Yes thank you. It’s amazing how you can get vars with param() quickly and with clean code. I was not aware about param! Thank you!