# Add content to a menu depending on the child/parent? page?

**URL:** <https://www.ruby-forum.com/t/add-content-to-a-menu-depending-on-the-child-parent-page/114154>\
**Category:** Radiant CMS\
**Created:** [September 8, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/add-content-to-a-menu-depending-on-the-child-parent-page/114154 "2007-09-08T18:18:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [September 8, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/add-content-to-a-menu-depending-on-the-child-parent-page/114154/1 "2007-09-08T18:18:24Z")

</div>

Hello,

I would like to do the following with a radiant site I’m trying to  
build.

sidebar contains a menu:

- news
- band
- history  
etc.

the menu is build from all the children of the ‘top’ page, so I have  
the following for the sidebar:  
\<r:find url="/"\>  
\<r:children:each order=“asc”\>

### 

What I would like to do (but don’t know how to do yet) is to add  
content to the menu when I’m visiting a certain page.

i.e. when currently on the band page, you see:

- news
- band
  - trumpet
  - piano
  - bass

- history

And when on the news page, you see

- news
  - current
  - very old

- band
- history

So that would mean my sidebar should be adding content depending on  
whether the page your looking at matches a certain child/parent?.

Any thoughts on how to do this (from radiant?)  
Or should I be looking at writing a plugin to get this done?

Best regards,

Jeroen J.

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [September 8, 2007, 6:27pm UTC](https://www.ruby-forum.com/t/add-content-to-a-menu-depending-on-the-child-parent-page/114154/2 "2007-09-08T18:27:25Z")

</div>

Given the following tag (just the inverse of the “unless\_self” tag  
defined by Sean in a recent thread):

tag “if\_self” do |tag|  
tag.expand if tag.globals.actual\_page == tag.locals.page  
end

Seems that it could be as easy as:

\<r:find url="/"\>  
\<r:children:each order=“asc”\>

### 
 ... 

```
/AITOR
```

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [September 8, 2007, 6:39pm UTC](https://www.ruby-forum.com/t/add-content-to-a-menu-depending-on-the-child-parent-page/114154/3 "2007-09-08T18:39:29Z")

</div>

Hi,

Thanks very much! This works exactly as I need it.  
Any hopes of getting this in the next version of radiant?

Jeroen

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [September 8, 2007, 6:44pm UTC](https://www.ruby-forum.com/t/add-content-to-a-menu-depending-on-the-child-parent-page/114154/4 "2007-09-08T18:44:29Z")

</div>

> Any hopes of getting this in the next version of radiant?

In the meanwhile you can do it with the back door extension with  
something  
in the line of:

\<r:if cond=“tag.globals.actual\_page == tag.locals.page”\>  
…  
\</r:if\>

```
/AITOR
```
