Hello,
in order to do some filtering I use a custom route in my config file as suggested in this cookbook example.
'routes' => [
[
'pattern' => 'work/(:any)',
'action' => function ($filter) {
if ($page = page('work/' . $filter)) {
return $page;
} else {
return page('work')->render([
'filter' => $filter
]);
}
}
]
],
Although this works as intended it causes problems with preview of draft pages. I found that this has already be documented here.
I tried to implement the solution described in my code but didn’t have any success.
Any thoughts? Thanks in advance.