Forum
Accessing page attributes in navigation templates
In previous versions of perch, I've been able to add a page attribute to a page and then access that attribute in navigation templates like so:
<perch:pages id="page_intro" />
... with page_intro being the attribute in question...
I can't seem to do that in the latest version. If I use <perch:showall />, the attributes are there, but as an object in pageAttributes, i.e.
pageAttributes {"page_intro":{"_flang":"html","raw":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed{...}
How can I get access to that value in navigation templates? Is there a way to access object values?
Something like this would be handy ;-)
<perch:pages id="pageAttributes.page_intro.raw" />
<perch:pages id="page_intro">
would be correct if you add the missingtype
attribute.Thanks for your reply - it was because I copied and pasted the nav snippet from a previous site I had built which used 'use-attributes' => false. So, my bad...
For your info, <perch:pages id="page_intro"> works just fine without the type attribute.
Sorry to have taken your time!