# Render snippet in relation to child page

**URL:** <https://www.ruby-forum.com/t/render-snippet-in-relation-to-child-page/148592>\
**Category:** Radiant CMS\
**Created:** [September 15, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/render-snippet-in-relation-to-child-page/148592 "2008-09-15T12:37:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlpulley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@carlpulley](https://www.ruby-forum.com/u/carlpulley)\
**Post date:** [September 15, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/render-snippet-in-relation-to-child-page/148592/1 "2008-09-15T12:37:04Z")

</div>

Hi all,  
I recently created my first custom Page Type, with custom radius tags.  
Of course this is all thanks to those who have done the hard work and  
made some great documentation. It was becuase of these new radius tag’s  
that I noticed whenever a snippet is rendered it is always in relation  
to the current page, that is even in this case:  
\<r:children:each\>\<r:child\>\<r:snippet name=“my-snippet”  
/\>\</r:child\>\</r:children:each\>  
The snippet will not be rendered in terms of the child page.  
Cases where someone might want to do this, is to make their site as DRY  
as possible.  
I located that line that would be making it work in this manner. Line  
530:

> <https://github.com/radiant/radiant/blob/master/app/models/standard_tags.rb>

But not knowing if this is by design, or exactly what a change here  
would mean, I thought I would ask for you thoughts. Any input would be  
appreciated.

Cheers,  
Carl.

---

<div class="post-metadata">

**Author:** ![carlpulley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@carlpulley](https://www.ruby-forum.com/u/carlpulley)\
**Post date:** [September 15, 2008, 1:52pm UTC](https://www.ruby-forum.com/t/render-snippet-in-relation-to-child-page/148592/2 "2008-09-15T13:52:09Z")

</div>

> I noticed whenever a snippet is rendered it is always in relation  
> to the current page, that is even in this case:  
> \<r:children:each\>\<r:child\>\<r:snippet name=“my-snippet”  
> /\>\</r:child\>\</r:children:each\>

I think the error is with your Radius tags. Try instead:

```
<r:children:each><r:snippet name="my-snippet"/></r:children:each>

```

This should render “my-snippet” from the context of each child page.  
Take a  
look at this article for more info:

[http://wiki.radiantcms.org/Tags\_that\_change\_the\_scope](http://wiki.radiantcms.org/Tags_that_change_the_scope)

Hope this helps,

Drew

---

<div class="post-metadata">

**Author:** ![carlpulley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@carlpulley](https://www.ruby-forum.com/u/carlpulley)\
**Post date:** [September 15, 2008, 3:26pm UTC](https://www.ruby-forum.com/t/render-snippet-in-relation-to-child-page/148592/3 "2008-09-15T15:26:50Z")

</div>

Also keep in mind that the tags available to be rendered are only the  
tags defined on the current “global” page – the page that’s directly  
being rendered. If you are rendering the parent page, the child page’s  
custom tags will not be available to the parent.

Sean

---

<div class="post-metadata">

**Author:** ![carlpulley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@carlpulley](https://www.ruby-forum.com/u/carlpulley)\
**Post date:** [September 15, 2008, 11:40pm UTC](https://www.ruby-forum.com/t/render-snippet-in-relation-to-child-page/148592/4 "2008-09-15T23:40:54Z")

</div>

Sean C. wrote:

> Also keep in mind that the tags available to be rendered are only the  
> tags defined on the current “global” page – the page that’s directly  
> being rendered. If you are rendering the parent page, the child page’s  
> custom tags will not be available to the parent.
> 
> Sean

Thank you very much for your help here. I guess I will need to make the  
radius tags I am wanting to use available from somewhere else, and not  
just on this page type.

Carl
