How do I sort all pages from within nested subsections?


#1

I have the following code:

{% set_global pages = [] %}
  {% for subsection_path in section.subsections %}
    {% set subsection = get_section(path=subsection_path) %}
    {% set_global pages = pages | concat(with=subsection.pages)  %}
{% endif %}

As you can see, I’ll have the “pages” array with all the pages from all subsections within. The problem is this is unsorted.

I’d like to sort these “pages” by date. How can I do this?


#2

I think you want to use transparent sections: https://www.getzola.org/documentation/content/section/#front-matter