How do I create a child layout which fills in multiple "content" holes in its parent layout?


#1

Here is the parent layout:

% assign products_hash = site.data.{{ page.product-collection }} %}
{% assign products = products_hash[{{page.product-collection}}] %}
<div class="page-header text-center">
  <h2>{{ page.title }}</h2>
</div>
{{ page.content }}
<div id="products" class="row list-group">
  {% for product in products %}
    <div class="item  col-xs-4 col-lg-4">
      <a href="{{ "/" | append: product.slug | prepend: page.product-collection | prepend: '/' | prepend: site.baseurl }}">
        <div class="thumbnail">
          <img class="group list-group-image" src="{{ "/assets/" | append: product.cover-photo | prepend: site.baseurl }}" alt="product image" />
          <div class="caption">
            <h4 class="group inner list-group-item-heading">{{ product.name }}</h4>
            <p class="group inner list-group-item-text">
              {{ product.short-description }}
            </p>
            {{content}}
          </div>
        </div>
      </a>
    </div>
  {% endfor %}
</div>

I would like to have multiple “holes” in this parent layout which can be filled in by a child layout. I can create a single “hole” by using {{content}}. Is there a way to do this in multiple places in the same parent layout?


#2

Not sure what your use case is… but would simply using includes not work?

As in, could you move everything in the “products” div into a separate html file and include?