Don’t know if. this is the best way to go about this, but try:
c::set('routes', array(
array(
'pattern' => 'blog/(:any)',
'action' => function($uid) {
if($page = page('blog/'.$uid)) {
go($page->parent());
} else {
$categories = page('blog')->children()->pluck('uri', ',');
$i = 0;
while($i < count($categories)) {
if($page = page($categories[$i].'/'.$uid)) {
return site()->visit($page);
}
$i++;
}
}
return false;
}
),
array(
'pattern' => 'blog/(:any)/(:any)',
'action' => function($cat, $uid) {
go('blog/'.$uid);
}
)
));
BTW. When a topic is solved, could you please either let u. know and/or mark it as solved? There are quite a few of your questions here where I’m not sure if I can close them or not.
Edit: In the above, you have to replace blog
of course…