Pages plugin - structure
Created 8 years ago by kiltedup

Hi,

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?

TIA

adnan  —  8 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  —  8 years ago

@adnan there is also a root option which you can send a page instance / path string: https://github.com/anomalylabs/pages-module/blob/master/src/Page/Command/RenderNavigation.php#L51

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

kiltedup  —  8 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 }}