title: How do I incorporate Multiple Markdown files into a Nunjucks template with Eleventy?
body: <h1>CONTEXT:</h1>
  <ul>
  <li>Eleventy and Nunjucks (and Markdown)</li>
  <li>A lot of long-form text (easier to create/edit using markdown).</li>
  <li>Complex layouts.</li>
  <li>Still new to SSGs</li>
  </ul>
  <h1>GOAL:</h1>
  <ul>
  <li>Manage chunks of text content using markdown.</li>
  <li>Use these markdown files with template partials.</li>
  <li>Assemble partials into a page.</li>
  </ul>
  <h1>EXPECTED RESULT</h1>
  <p>Processed html page:</p>
  <pre><code>    &lt;html&gt;
        &lt;body&gt;
          &lt;div&gt;
            &lt;p&gt;Some content originating from a markdown file.&lt;/p&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;p&gt;Some content originating from another markdown file.&lt;/p&gt;
          &lt;/div&gt;
        &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  <hr />
  <h1>ATTEMPTED ACTIONS</h1>
  <p>Here is what I've tried so far...</p>
  <p>(Note: I've excluded my base.njk (html doctype shell) for readability.)</p>
  <h2>1. NJK MAIN with NJK PARTIAL INCLUDES</h2>
  <h3>INPUT</h3>
  <p>Directory Structure</p>
  <pre><code>src/
      /_includes
          base.njk
          _layout-A.njk
          _layout-B.njk
      main-layout.njk
      content-1.md
      content-2.md
  </code></pre>
  <p>main-layout.njk</p>
  <pre><code>    {% extends &quot;base.njk&quot; %}
  
      {% block content %}
  
          {% include '_layout-A.njk' %}
  
          {% include '_layout-B.njk' %}
  
      {% endblock %}
  </code></pre>
  <p>content-1.md</p>
  <pre><code>    ---
      layout: _layout-A.njk
      --- 
      Some content.
  </code></pre>
  <p>_layout-A.njk</p>
  <pre><code>    &lt;div&gt;{{ content | safe }}&lt;/div&gt;
  </code></pre>
  <p>content-2.md</p>
  <pre><code>    ---
      layout: _layout-B.njk
      --- 
  
      Some more content.
  </code></pre>
  <p>_layout-B.njk</p>
  <pre><code>    &lt;div&gt;{{ content | safe }}&lt;/div&gt;
  </code></pre>
  <h3>RESULT</h3>
  <ul>
  <li>Directory structure 'splits'.</li>
  </ul>
  <pre><code>dist/
      /content-1
          index.html
      /content-2
          index.html
      /main-layout
          index.html
  
  </code></pre>
  <ul>
  <li>Markdown content not passed through to parent page. Empty child tags in parent.</li>
  </ul>
  <p>main-layout/index.html</p>
  <pre><code>    &lt;html&gt;
        &lt;body&gt;
          &lt;div&gt;&lt;/div&gt;
          &lt;div&gt;&lt;/div&gt; 
        &lt;/body&gt;
      &lt;/html&gt;
  
  </code></pre>
  <hr />
  <p>I'm at a loss for how the files are processed and what I can do to do what I set out to.</p>