Hi!
I’m working on a directory of design pieces in a collection. The pages are structured showing first a list of designers (using taxonomies and taxonomylist-plugin). After clicking on the designer’s name, a list with correspondent design pieces appears (posts styled as dropdown accordions).
Here’s the structure:
_Designer A
_Designer B
___Item 1 (by Artist B)
___Item 2 (by Artist B)
___Item 3 (by Artist C)
_Designer C
I managed to sort the designers using ksort, however I have no idea how to achieve this for the design items (posts). Please find below the code I’m using:
<li>
{% set tags = taxonomy.taxonomy['designer']|ksort %}
{% for tag, items in tags %}
<button class="accordion">
<h1>{{ tag }}</h1>
</button>
<div class="panel">
{% for path, slug in items %}
{% set post = grav['pages'].get(path) %}
{% if post.title != null %}
<button class="accordion sublevel">
<h1>{{ post.title }}</h1>
</button>
<div class="panel sublevel">
<p>{{ post.content }}</p>
</div>
{% endif %}
{% endfor %}
</div>
</li>
Does anyone have an idea on how to solve this issue? I’m unfortunately not really a coding pro. Thanks in advance!
Cheers