Hi, first of all, thank you for your amazing work on this CMS, I absolutely love working with it !
However, I currently have an issue previewing drafts with my custom routes.
This issue has already been raised here : Draft Preview giving error page and here : Issue with route and draft page preview so I tried to adapt my routes to make it work but I canât seem to figure why it doesnâtâŚ
This is the routes I am using :
[
âpatternâ => â(:any)â,
âactionâ => function($uid) {
$page = page($uid);
if(!$page) $page = page('realisations/' . $uid);
if(!$page) $page = page('ressources/' . $uid);
if(!$page) $this->next();
return site()->visit($page);
}
],
[
'pattern' => ['realisations/(:any)', 'ressources/(:any)'],
'action' => function($uid) {
return go($uid);
}
],
and the custom page model :
<?php
class RealisationPage extends Page {
public function url($options = null): string {
return $this->site()->url() . '/' . $this->slug();
}
}
I also tried with different variations in the preview blueprint and the whole thing only work if I remove the routes and set the preview to this :
options:
preview: "{{ site.url }}/{{ page.parent.slug }}/{{ page.slug }}"
At this point, I donât know if I just made a typo mistake somewhere or if I am doing something completely wrong.
If anyone can help, it would be greatly appreciated, thank you in advance.