Answers.Body: <p>I believe it is possible @jack. Take a look at this working demo - <a href="http://twigfiddle.com/9rwjeo" rel="nofollow">http://twigfiddle.com/9rwjeo</a></p>
  
  <hr>
  
  <p>Update:</p>
  
  <p>On closer inspection the original example did not work. You can not have a block inside an include how you are describing.</p>
  
  <p>I have update the twig fiddle with a work around though</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-03T06:39:57.287Z
Answers.Text: Thanks @Fyrebase. Apologies for my deleted comments as I was working off older versions of this page and the Twigfiddle example. So, yes, you have confirmed my finding. Thanks for the workaround - I haven't tried it yet in my code but I'm pretty sure it will do the job based on your demo. It is a pity because I like the include model for structuring my twig code - I find it cleaner than using blocks which I prefer for smaller bits of code. Perhaps I can get the workaround to fit my style. I didn't know about Twigfiddle, so that is a useful bit of info for me too. Thanks.
Answers.UserDisplayName: Jack McKenzie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-03T06:53:30.317Z
Answers.Text: Update: Yes it worked in my code. I just needed to add a |raw filter to deal with the HTML :)
Answers.UserDisplayName: Jack McKenzie
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-17T23:55:26.607Z
Answers.Text: It's also worth noting that blocks don't work in the reverse either - you cannot define a block in the main template and override it inside an include. So as a general rule:  **don't use the {% block %} tag inside an include file**.
Answers.UserDisplayName: Simon East
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-03T03:32:19.753Z
Answers.LastActivityDate: 2016-08-03T05:07:46.680Z
Answers.LastEditDate: 2016-08-03T05:07:46.680Z
Answers.UserDisplayName: Fyrebase
Body: <p>I have a _layout.html template which has both an include partial <code>{% include '_partials/_header.html' %}</code> and a block section (e.g. Content) for other templates to extend it.</p>
  
  <p>Can I put another block section (e.g. Breadcrumb) inside the include file and use that in a template which extends _layout.html? So far it doesn't seem to work. If I move the Breadcrumb block from the include template into _layout.html it works fine, and when I move it back the content in the template extension does not show.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-03T03:33:01.787Z
Comments.Text: Could you provide an example of your code as a twig fiddle at http://twigfiddle.com/
Comments.UserDisplayName: Fyrebase
Tags: <templating><include><blocks>
Title: Can I use a Block inside an Include file?
ThreadText: # Can I use a Block inside an Include file?
  
  (Asked by: username_0 on 2016-08-03)
  
  I have a \_layout.html template which has both an include partial `{% include '_partials/_header.html' %}` and a block section (e.g. Content) for other templates to extend it.
  
  Can I put another block section (e.g. Breadcrumb) inside the include file and use that in a template which extends \_layout.html? So far it doesn't seem to work. If I move the Breadcrumb block from the include template into \_layout.html it works fine, and when I move it back the content in the template extension does not show.
  
  **Tags:** templating, include, blocks
  
  > **Comments:**
  > **username_1**: Could you provide an example of your code as a twig fiddle at http://twigfiddle.com/  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-03. Score: 4 | Accepted answer
  
  I believe it is possible @username_0. Take a look at this working demo - <http://twigfiddle.com/9rwjeo>
  
  ---
  
  Update:
  
  On closer inspection the original example did not work. You can not have a block inside an include how you are describing.
  
  I have update the twig fiddle with a work around though
  
  > **Comments:**
  > **username_0**: Thanks @username_1. Apologies for my deleted comments as I was working off older versions of this page and the Twigfiddle example. So, yes, you have confirmed my finding. Thanks for the workaround - I haven't tried it yet in my code but I'm pretty sure it will do the job based on your demo. It is a pity because I like the include model for structuring my twig code - I find it cleaner than using blocks which I prefer for smaller bits of code. Perhaps I can get the workaround to fit my style. I didn't know about Twigfiddle, so that is a useful bit of info for me too. Thanks.  
  > **username_0**: Update: Yes it worked in my code. I just needed to add a |raw filter to deal with the HTML :)  
  > **username_2**: It's also worth noting that blocks don't work in the reverse either - you cannot define a block in the main template and override it inside an include. So as a general rule:  **don't use the {% block %} tag inside an include file**.  
  
  ---
  
  