Answers.Body: <p>Try to keep the blocks separate in your child template. That's how it's done in a <a href="http://twig.sensiolabs.org/doc/tags/extends.html#child-template" rel="noreferrer">comparable example</a> in the Twig Documentation.</p>
  
  <p>Parent Template:</p>
  
  <pre><code>{% block breadcrumbs %}
      {% block crumb %} 
      {% endblock %}
  {% endblock %}
  </code></pre>
  
  <p>Child Template:</p>
  
  <pre><code>{% extends "parent.html" %}
  
  {% block breadcrumbs %}
      {{ parent() }}
  {% endblock %}
  
  {% block crumb %}
      My custom content
  {% endblock %}
  </code></pre>
  
  <p>.</p>
  
  <p><em>Edit:</em></p>
  
  <p>If you're not adding any content to your "breadcrumbs" block from the child template, you can also omit that block completely:</p>
  
  <pre><code>{% extends "parent.html" %}
  
  {% block crumb %}
      My custom content
  {% endblock %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-17T01:09:10.960Z
Answers.Text: Hey @carlcs that does not work for me either. It is still hitting the parent block crumb content
Answers.UserDisplayName: Matt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T13:16:26.363Z
Answers.Text: Hey @carlcs you are right. This does work as you've suggested. However, I can only get it to work with other blocks. There seems to be some error with my crumb block which is not working for me. Thanks for your help.
Answers.UserDisplayName: Matt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-16T22:02:06.623Z
Answers.LastActivityDate: 2014-08-18T10:16:53.230Z
Answers.LastEditDate: 2014-08-18T10:16:53.230Z
Answers.UserDisplayName: carlcs
Body: <p>I'm not sure if it is appropriate to post twig questions on this forum? I have a question about nested blocks and using the twig "parent" function. I'm running into unexpected behaviour on a craft site i'm building. </p>
  
  <h2>My parent and child template layouts.</h2>
  
  <pre><code>{# Parent Template #}
  {% block breadcrumbs %}
      {% block crumb %}
  
      {% endblock %}
  {% endblock %}
  
  {# Child Template #}
  {% block breadcrumbs %}
      {{ parent() }}
      {% block crumb %}
          My custom content
      {% endblock %}
  {% endblock %}
  </code></pre>
  
  <h2>What I'm trying to achieve</h2>
  
  <ul>
  <li>On my child template, I'm trying to retain the content in block breadcrumbs but override the content in block crumb.</li>
  <li>However when I use the parent function in my child template, it does not respect "my custom content" and uses the block crumb content defined in the parent template.</li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-17T03:01:57.960Z
Comments.Text: Who you ever add content after the crumb block?
Comments.UserDisplayName: Luke Holder
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-18T10:35:11.777Z
Comments.Text: Tested your code, Matt. I do get the parent's "breadcrumbs" content with the `parent()` function and I also get the child's "crumb" content with this. Problematic though, you'll get "My custom content" twice if you're nesting the blocks in the child layout. But that is as expected, if you think about it.
Comments.UserDisplayName: carlcs
Tags: <templating>
Title: How to use twig parent function on nested blocks
ThreadText: # How to use twig parent function on nested blocks
  
  (Asked by: username_0 on 2014-08-16)
  
  I'm not sure if it is appropriate to post twig questions on this forum? I have a question about nested blocks and using the twig "parent" function. I'm running into unexpected behaviour on a craft site i'm building.
  
  ## My parent and child template layouts.
  
  ```
  {# Parent Template #}
  {% block breadcrumbs %}
      {% block crumb %}
  
      {% endblock %}
  {% endblock %}
  
  {# Child Template #}
  {% block breadcrumbs %}
      {{ parent() }}
      {% block crumb %}
          My custom content
      {% endblock %}
  {% endblock %}
  
  ```
  
  ## What I'm trying to achieve
  
  * On my child template, I'm trying to retain the content in block breadcrumbs but override the content in block crumb.
  * However when I use the parent function in my child template, it does not respect "my custom content" and uses the block crumb content defined in the parent template.
  
  **Tags:** templating
  
  > **Comments:**
  > **username_1**: Who you ever add content after the crumb block?  
  > **username_2**: Tested your code, username_0. I do get the parent's "breadcrumbs" content with the `parent()` function and I also get the child's "crumb" content with this. Problematic though, you'll get "My custom content" twice if you're nesting the blocks in the child layout. But that is as expected, if you think about it.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-08-16. Score: 7 | Accepted answer
  
  Try to keep the blocks separate in your child template. That's how it's done in a [comparable example](http://twig.sensiolabs.org/doc/tags/extends.html#child-template) in the Twig Documentation.
  
  Parent Template:
  
  ```
  {% block breadcrumbs %}
      {% block crumb %} 
      {% endblock %}
  {% endblock %}
  
  ```
  
  Child Template:
  
  ```
  {% extends "parent.html" %}
  
  {% block breadcrumbs %}
      {{ parent() }}
  {% endblock %}
  
  {% block crumb %}
      My custom content
  {% endblock %}
  
  ```
  
  .
  
  *Edit:*
  
  If you're not adding any content to your "breadcrumbs" block from the child template, you can also omit that block completely:
  
  ```
  {% extends "parent.html" %}
  
  {% block crumb %}
      My custom content
  {% endblock %}
  
  ```
  
  > **Comments:**
  > **username_0**: Hey @username_2 that does not work for me either. It is still hitting the parent block crumb content  
  > **username_0**: Hey @username_2 you are right. This does work as you've suggested. However, I can only get it to work with other blocks. There seems to be some error with my crumb block which is not working for me. Thanks for your help.  
  
  ---
  
  