Sitekit Forums

Sitekit Forums

Developer Discussion - child and sibling pages

Ian Collie

Posted on 26 November 2015

Is there currently any way to identify, possibly within a sitekit:if tag, if a page has siblings or children? I'm thinking adding/omitting particular types of page content depending on whether the page has siblings or children. As a very simple example, if there are children then display nav with "In this section" heading, if there are siblings but no children then use "Also in this section" instead. Could hack something together client side to do it but would be nice if there was a server side solution. (I recognise that it is entirely possible that this is either: IMPOSSIBLE!!!! or else really simple and I've just missed something) Any thoughts or suggestions welcome

Joseph Lyons (Sitekit)


Posted on 08 November 2017

Hi Ian - this would be possible, but not by using magic/reserved words. 

One option is to use the CHILD snippet which lists all visible children of a page that have the "Hide page as internal link" unticked. Conditional headers can be added in the RefChildHeaderText variable block. 

The (more complicated) alternative is to use XML data islands and one of the Sitekit XML web services that lists child pages of a given node. I think the "GetChildPagesByNodeID_JSON" method does something like that (/adminv9/API/NavigationWS.asmx). 

The only major advantage of this more complicated method is that it allows you to "wrap" the child page listing with conditional elements e.g. a

that wraps everything, whereas the Variable Block solution doesn't handle this so well.