Example:
I've a template 'columns.html.twig', with two columns as following:
---html
<div class="container">
<div class="row">
<div class="col-xs-6">
{% for child in page.collection %}
{% if child.header.position!="right" %}
{% include 'partials/item.html.twig' with {'page':child, 'truncate':true} %}
{% endif %}
{% endfor %}
</div>
<div class="col-xs-6">
{% for child in page.collection %}
{% if child.header.position=="right" %}
{% include 'partials/item.html.twig' with {'page':child, 'truncate':true} %}
{% endif %}
{% endfor %}
</div>
</div>
</div>
As you can see, the twig-code loops through each sub-page and renders the content of each sub-page with the 'partials/item.html.twig' template.
By the way: This only works, when you define a 'columns.md' with following header information:
content:
items: @self.children
order:
by: name
dir: asc
You then just have to put the content for the two columns in sub-folders. In the item.html.twig of each sub-page you only have to put a variable named 'position'
Example:
title: Aktuell
position: right
If position equals 'left' or is missing the content is rendered in the left column.
In the item.html.twig it is also possible to render an image with for instance
{{ page.media.images|first.cropZoom(900,300).html }}
My Question: Is there a better (less complicated) way to manage content in two or more columns?