<p>Craft's uses the Twig templating language. The official Twig documentation <a href="http://twig.sensiolabs.org">http://twig.sensiolabs.org</a> is really good, highly recommended to read most of it!</p>

<p>For your specific problem have a look at the section about the <a href="http://twig.sensiolabs.org/doc/tags/extends.html"><code>extends</code></a> tag. It explains how to define blocks and extend other template files. Another important technique is including partials into a template with the <a href="http://twig.sensiolabs.org/doc/tags/include.html"><code>include</code></a> tag.</p>

<p>For a good and rather simple example I would recommend to read the source code of Pixel and Tonic's <a href="https://github.com/pixelandtonic/ontherocks/blob/master/craft/templates/index.html">On The Rocks</a> Craft demo page.</p>

CC BY-SA 3.0
2016-02-12T13:18:12.867Z
2016-02-12T13:18:12.867Z
carlcs
<p>I am a beginner when it comes to Craft and I have a hard time finding good detailed tutorials when it comes to specific questions. I know that Craft has it's own documentation but for me it's a little hard to find exactly what I want. So what I would like to know is how you can embed the header and the footer in every page with a simple tag.</p>

<p>I know that in Expression Engine all you had to do is was the following:</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;News Site&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    {layout:contents}
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>And on any other page you could add this tag and you were done.</p>

<pre><code>{layout="site/.html-layout"}

{exp:channel:entries channel="news"}
  &lt;h2&gt;{title}&lt;/h2&gt;
  {summary}
{/exp:channel:entries}
</code></pre>

<p>How can I achieve the same thing in Craft? Thank you for your time and help :)</p>

<templating>
Make use of wrapping layouts in Craft
# Make use of wrapping layouts in Craft

(Asked by: username_0 on 2016-02-12)

I am a beginner when it comes to Craft and I have a hard time finding good detailed tutorials when it comes to specific questions. I know that Craft has it's own documentation but for me it's a little hard to find exactly what I want. So what I would like to know is how you can embed the header and the footer in every page with a simple tag.
I know that in Expression Engine all you had to do is was the following:

  
    News Site
  
  
    {layout:contents}
  


And on any other page you could add this tag and you were done.
{layout="site/.html-layout"}

{exp:channel:entries channel="news"}
  {title}
  {summary}
{/exp:channel:entries}

How can I achieve the same thing in Craft? Thank you for your time and help :)

**Tags:** templating

---

## 1 answers

### Answer by username_1 on 2016-02-12. Score: 4 | Accepted answer

Craft's uses the Twig templating language. The official Twig documentation <http://twig.sensiolabs.org> is really good, highly recommended to read most of it!

For your specific problem have a look at the section about the [`extends`](http://twig.sensiolabs.org/doc/tags/extends.html) tag. It explains how to define blocks and extend other template files. Another important technique is including partials into a template with the [`include`](http://twig.sensiolabs.org/doc/tags/include.html) tag.

For a good and rather simple example I would recommend to read the source code of Pixel and Tonic's [On The Rocks](https://github.com/pixelandtonic/ontherocks/blob/master/craft/templates/index.html) Craft demo page.


---

