Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
If using nested pages, is there a way of finding our what the penultimate parent of the current page is - that is, the section below the root into which it falls in the hierarchy?

Background:
I'm looking at using nested pages on my current project. The design has a home page, two special pages for what's on and for current news, and three other sections - about, help and one with a working title of 'more'. These three sections use the same content structure, with fairly minor design differences.

So I'm looking at a nested pages structure which may be something like this (abbreviated to save typing):
Code: Select all
Home =>
| - About Us
|   | -  What we Do
|   |   | - Portfolio
|   |   | - Testimonials
|   | -  Our Background
|   |   | - Origins
|   |   | - Principles
|
| - What's On =>
|
| - Help
|   | - Contact Us
|   | - Get Resources
|   |   | - Files
|   | - Ask a Question
|   |   | - Question 1
|   |   | - Question 2
|   |   | - ...



The Problem
In each section, I only want the side menu on the page to show the pages in that section. So if you're on a page which 'descends' from 'About', the side menu should show the children, grandchildren etc of 'About Us', and nothing else. The menu 'childof' tag does this - but child of what?

The special root sectors such as '@1' or '@current' don't seem to help here because I don't know how many levels down the current page may be.
I think you'll find that the answer is easy once you take a look at this -
https://docs.couchcms.com/tags-referenc ... namic-menu

Please feel free to let me know if you still have any difficulty.
Thanks, @KK - having re-read the section, it does indeed answer the question.

I'd read 'first parent' as 'immediate parent', rather than 'highest parent in the hierarchical tree'.
3 posts Page 1 of 1