Hi folks,
I’ve set the /blog
page as my homepage on my site with this:
return [
'home' => 'blog',
It works well, but blog post URLs are bit funky, in that they now include /blog/
in the URL. I’d like to remove this, which I’ve been able to do with the following route:
'routes' => [
[
'pattern' => '(:any)',
'action' => function($uid) {
$page = page($uid);
if(!$page) $page = page('blog/' . $uid);
if(!$page) $page = site()->errorPage();
return site()->visit($page);
}
],
[
'pattern' => 'blog/(:any)',
'action' => function($uid) {
go($uid);
}
]
]
However, on my blog home page (where all my blog posts are listed), the links to the single posts still include the /blog/
part of the URL.
How do I remove them from there too? Basically, I’d like /blog/
to go away from my site entirely, as my homepage is my blog, so the concept of /blog/
just isn’t a thing on my site.
Thanks!