Closed neildaniels closed 5 years ago
I would love to see that restored too! In the meantime I had to replicate a bit of the default behavior by manually rendering the page with the right representation from the router:
site()->visit($page, $locale);
if ($extension) {
return kirby()
->response()
->body($page->render([], $extension))
->type($extension);
}
return $page;
@LeBenLeBen that's a good workaround for now. I will try to fix this in a more elegant way though.
After thinking about it some more, the correct approach in v3 is to use $kirby->resolve($path, $languageCode) in such cases.
Describe the bug This is sort of the 2nd part of #1362. I believe this is a regression from Kirby 2, but because of the removal of the
filter
route parameter, I've never actually needed to hit this case before.If you visit a page such as
/sitemap.xml
and that path hits matches a route, at some point you would probably like to invokesite()->visit($page)
. However, by the time you have a Page model object, that Page doesn't have any intrinsic knowledge of the content representation you requested. That should still be part of the route/current URL though.I would expect that the
visit()
method would be able to correctly infer that an XML representation (in this case) is still the intent. Currently, it does not infer that the XML representation should be provided.To Reproduce Steps to reproduce the behavior:
site()->visit($page)
Expected behavior I would expect the content representation template to be used, not the "normal" one.
Kirby Version
3.0.0
Additional context Here's a basic route with a hacky workaround for #1362.