Show child and sibling pages

Hi,

I am wondering if there is a way to list the child or sibling pages of a page automatically. For example under About section has sub pages:

Mission | History | Staff | Contact

With the loop below I can see those sub-pages when I am on the About page. But when I got to one of the sub-pages I want that to remain so it would be displaying sibling pages of the About parent page.

<Loop field=children>
  <strong><a href="{Field url}"><Field title /></a></strong>
</Loop>

And can this be done to show on all parent pages or does it have to be done on a page by page basis (if it’s possible)?

Thanks!

I’m sure there are several different ways to approach this and I can’t guarantee that the one I’ve thought of is the best, but here’s where my head’s at. Basically what’s going on here is that if there are no children associated with the current page, I’m looping through the children field of the current item’s parent. I’m doing that using the parent_* field which is mentioned in the post loop docs:

parent_* - Parent field where the asterisk can be replaced with any field from the post loop such as parent_title

So below is what I came up with.

<p><Field children /></p>
<If field=children exists>
  <Set query=child_posts field=children />
  <Else />
  <Set query=child_posts field=parent_children />
</If>

<Loop query=child_posts>
  <strong><a href="{Field url}"><Field title /></a></strong>
</Loop>

If you wanted to get super compact with that, you could probably also write that as:

<Loop field="{If field=children not_exists}parent_{/If}children">
  <strong><a href="{Field url}"><Field title /></a></strong>
</Loop>

Let me know if that works out for you or if this helps you come up with a different approach!