How can I pass variables to a page in a route? I know there’s $site->visit()
and return page()
. In Kirby 2 I could add a $data
array.
There nothing about that in the Routing docs, either.
That’s how I thought it would work:
[
'pattern' => 'foo/(:any)',
'action' => function ($bar) {
$data = [
"bar" => $bar
];
return array("foo", $data);
}
]
But it will just display this on the page:
[
"foo",
{
"bar": "my-url"
}
]