Not sure if there’s something going on with my setup or what but is it normal that the home
is no longer included in the url of its subpages?
I have a blog where the posts are direct children of the homepage.
In K2 I was using a route to get rid of the /home/
.
Ok the slug was some weird leftover from my K2 installation but for some reason the url()
method is still printing the url without the /home/
part.
That’s probably the reason why pointing the home page to another page results in a 404 error when trying to load a subpage: https://github.com/getkirby/kirby/issues/1371
Ah interesting. Still, that doesn’t explain why $page->url()
called on a subpage is returning the url without the home
part. That’s happening even if I don’t change the name of the homepage in the settings
To expand:
return [
# Kirby Settings
'debug' => true,
'cache' => false
];
Even with just this in my config, if in my snippet I loop through the subpages of the homepage and print
<?= $p->url() ?>
(where $p
is the current post)
What I get is
.com/subpage-slug
Yes, exactly, and I assume that’s the router doing this. Does this at least work for the homepage called home
?
Nope. As I said, this is happening even if I use the home called home
It’s funny because on my K2 I was using a page model to overwrite the url()
method and remove the home
part. Now it’s happening no matter what.
And I only noticed that there was a problem because the preview of a draft was returning the error page
Yes, I got that (and some more chars)
If I dump the $page
variable this is what I get
[uid] => post-title
[uri] => home/post-title
[url] => http://site.com/post-title
In my test, the subpage of the home page called home
(with that truncated URL) also returns an error page (the same as when the home page is called something else). Can you confirm this?
texnixe
January 18, 2019, 5:46pm
10
I updated the issue, for me that is the same thing: https://github.com/getkirby/kirby/issues/1371
Because of the missing slug, subpages of home, no matter if that page is called home
or something else, resulting in 404.
1 Like
texnixe
January 18, 2019, 6:00pm
11
Until this issue is fixed, you can use a route to temporarily work around this.
Yes the route was already in place in my case so that’s not a huge issue. Unfortunately the draft preview is broken and I think it’s because of the same issue