Looping across pages from two different sections

#1

Hello everyone — I’m using Zola to build a personal site, and I have two sections set up as so:

<section>
  <p>Case Studies:</p>
  <ol>
      {% for post in section.pages %}
        <li><a href="{{ post.permalink }}">{{ post.title }}</a> <i>{{ post.year }}</i></li>
      {% endfor %}
  </ol>
</section>

<section>
  <p>Writing:</p>
  <ol>
  {% for post in section.pages %}
    <li><a href="{{ post.permalink }}">{{ post.title }}</a> <i>{{ post.year }}</i></li>
  {% endfor %}
  </ol>
</section>

I suspect that the key is in changing the bit in each code where {% for post in section.pages %} is specified, but I can’t seem to find anywhere in the documentation for Tera or Zola that explicitly calls out how to do this… any help would be appreciated!

Apologies in advance if I’m missing something clearly stated in the documentation — I seriously can’t seem to find how to target specific sections in the templating language :disappointed_relieved:

#2

You probably want to get the section using https://www.getzola.org/documentation/templates/overview/#get-section