Brilliant! Thanks for the help!
Edit with cut-down version of my final solution:
I opted not to go with transparent
only because it brings in other pages such as /about
which don’t naturally have dates and then need filtering out of the loop.
Instead this a demonstrative example of what I did
{% set blog = get_section(path="blog/_index.md") %}
{% set photos = get_section(path="photos/_index.md") %}
{% set feed = blog.pages | concat(with=photos.pages) %}
{% for page in feed | sort(attribute="date") | reverse %}
{% set section = page.components | first %}
{% if section == "blog" %}
<li><a href="{{ page.permalink | safe }}">{{ page.title }} - {{ page.date }}</a></li>
{% endif %}
{% if section == "photos" %}
<img src="{{ page.extra.lead_image }}" />
<li><a href="{{ page.permalink | safe }}">{{ page.title }} - {{ page.date }}</a></li>
{% endif %}
{% endfor %}
I preferred this solution as I’m likely to only ever have half a dozen sections I want to iterate over and it works better than transparent
with other filters such as slice
. An example was that I was fudging a date onto my other pages and simply not rendering them with my section
check. However that threw off my slice
filter if any of the dates happened to fall in the range I was after.
I have to tip my hat to the creators of Zola. It’s a very simple generator to understand (my other experiences are Hugo and Publish) but you can combine simple tools to order the data in quite complex ways. I also really appreciate the template language and explicit definition of template for each item of content (looking at you Hugo). Great work!