Pages plugin - structure
Created 7 years ago by kiltedup


Trying to use the Pages plugin function 'structure'.

Issue I'm having is that regardess of what I pass as the option for 'root', the output is the entire page structure of the site.

End result I'm looking for - say you are on a child page, structure will return all other child pages of the current pages parent.

Anyone used this successfully?


adnan  —  7 years ago

If I understood your question correctly, try the parent option,

{{ structure().parent(page().parent).listClass('nav navbar-nav navbar-right').render()|raw }}
ryanthompson  —  7 years ago

@adnan there is also a root option which you can send a page instance / path string:

Waiting to release pages 2.2 in order to write docs on it..

kiltedup  —  7 years ago

Thanks for the replies.

I was using the root option with a path string - turned out the issue was simply that there was no leading '/' on the string. Without that the entire tree was returned.

zvineyard  —  6 years ago

Just so it is clear, here is a practical tag example of what @kiltedup and @ryanthompson are talking about in this post:

{{ structure().root('/some/page/path').render()|raw }}