title: Recursive layouts with Handlebars.js
body: <p>I have a simple object hierarchy consisting of:</p>
  
  <pre><code>Category
   String name
   List childCategories;
  </code></pre>
  
  <p>I would like to represent this layout using handlebars in a generic way, but I am having trouble understand how to nest layouts. Given this layout:</p>
  
  <pre><code>&lt;script id="categories-template" type="text/x-handlebars-template"&gt;
      {{#categories}}
          &lt;ul &gt;
              &lt;li&gt;                    
                  &lt;span&gt;{{name}}&lt;/span&gt;       
                  &lt;div&gt;{{#childCategories}}{{/childCategories}}&lt;/div&gt;
              &lt;/li&gt;       
          &lt;/ul&gt;
      {{/categories}}
  &lt;/script&gt;
  </code></pre>
  
  <p>What is the best way to reuse the existing categories template for all the child categories? Is it necessary to register a handler? Is there an easier way?</p>