How can I access meta information about a page from using routes?
I’ve tried to use page('pagename')->meta()
without any luck
What is meta supposed to be? Is that a field in your content file? There is no native meta()
method in the page class that I’m aware of.
My bad for bad explanation.
By meta I mean the fields in the content.
If I create a field named price in the blueprint, I could access it in templates with $page->price()
, but how can I access that in routes?
Strange that it does not work, because it should. I did a brief test with this silly route:
array(
'pattern' => 'test',
'action' => function() {
echo page('some-page')->title();
}
)
and it prints the page title alright.
array(
"pattern" => "hello",
"method" => "GET",
"action" => function() {
echo site("booking")->title();
echo site("booking")->text();
}
)
When I call the hello page, I can only see the title, not text
You are using site()
instead of page()
, maybe a typo?
Oh, would you look at that
If I just used page() it works. Thanks guys